Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 44 Current »


With the Proteria CloudConnect API, you gain the ability to effortlessly import orders or shipments into Proteria Freight. You have the flexibility to decide whether these shipments or orders should be automatically dispatched to the transporters or if you prefer to utilize the web frontend to finalize the shipment process.

The Proteria CloudConnect API also provides support for Webhooks, enabling your system to receive real-time updates on the booking status of shipments. By leveraging automatic booking, you can conveniently retrieve the shipment label from the Proteria CloudConnect API and seamlessly integrate it into your own system. Furthermore, the API facilitates the updating of your system with accurate shipment tracking status information.

The base URL for the API is https://cloudconnect.proteria.com/, and the API-methods must be added to the end of this URL.

Content

(lightbulb) Step-by-step guide


Authorization:

  1. You must retrieve your API-token from web.proteria.com in order to use the Proteria CloudConnect API

  2. Log in, and then in the top-right corner click on your name → “Your Proteria API Key


  3. Copy the API key, and make sure that this is included in the header on every HTTP-request, in the 'Authorization'-tag. Remember to write the word Bearer before you include your API key.

    Example. “Authorization: Bearer YOUR_API_KEY”

API Flow

Additional APIs exists (see below)

Step

API

Comment

1

GET /ShippingMethods/GetShippingMethodsForCustomer

Find relevant shipping methods for your user

1.2

GET /Templates/GetTemplatesForCustomer

Get the available templates for your company.

1.3

GET /pickuppoint/GetPickUpPoints/{countryCode}/{postCode}/{carrier}

Returns a list of available pickup points close to the given postcode

1.4

GET /pickuppoint/GetParcelBoxPoints/{carrier}/{countryCode}/{postCode}

Returns a list of available parcel boxes close to the given postcode

2

POST /Shipping/CreateShipments

Make sure to set AutoSendShipments to true (or else you will need to use Proteria Freight GUI to manually send the shipments to transporter.

3

POST /label/GetLabel/{printFormat}

Get the available label

4

POST /print/Print

Print Label with CloudConnect printers (if workflow is not automated)

ShippingMethods API

 GET /ShippingMethods/GetShippingMethodsForCustomer

GET /ShippingMethods/GetShippingMethodsForCustomer

With this method, you can get all shipping methods currently available for for you.

This method requires authentication with the Proteria API key as bearer token.

JSON Response
[
    {
        "id": 1240,
        "displayText": "BringV2: Pakke levert hjem",
        "carrier": "BringV2",
        "services": [
            "service_evarsling",
            "service_enkelDelivery",
            "service_identification",
            "service_personalDelivery"
        ],
        "hasPickupPoints": false,
        "isReturnProduct": false,
        "isExpressProduct": false
    },
    {
        "id": 12100,
        "displayText": "BringV2: Pakke til bedrift",
        "carrier": "BringV2",
        "services": [
            "service_enkelDelivery"
        ],
        "hasPickupPoints": false,
        "isReturnProduct": false,
        "isExpressProduct": false
    },
    {
        "id": 1220,
        "displayText": "BringV2: Pakke til hentested",
        "carrier": "BringV2",
        "services": [
            "service_evarsling",
            "service_cod",
            "service_valgfrittHentested",
            "service_brevVarlsing",
            "service_identification",
            "service_personalDelivery"
        ],
        "hasPickupPoints": true,
        "isReturnProduct": false,
        "isExpressProduct": false
    },
	...,
]

URL Pattern:

URL Format
/ShippingMethods/GetShippingMethodsForCustomer

The fully constructed url:

URL Example - Single Shipment
https://cloudconnect.Proteria.com/ShippingMethods/GetShippingMethodsForCustomer

Templates API

 GET /ShippingMethods/GetShippingMethodsForCustomer

GET /Templates/GetTemplatesForCustomer

With this method, you can get all shipping methods currently available for for you.

This method requires authentication with the Proteria API key as bearer token.

JSON Response
[
    {
        "templateId": "freightshipmenttemplatedtos-65",
        "templateName": "Test",
        "isDefault": true,
        "module": "Fraktbrev",
        "displayName": "Fraktbrev - Test"
    },
    {
        "templateId": "freightshipmenttemplatedtos-97",
        "templateName": "test2",
        "isDefault": false,
        "module": "BringV2",
        "displayName": "BringV2 - test2"
    },
    {
        "templateId": "freightshipmenttemplatedtos-321",
        "templateName": "test 44",
        "isDefault": false,
        "module": "BringV2",
        "displayName": "BringV2 - test 44"
    },    
	...,
]

URL Pattern:

URL Format
/Templates/GetTemplatesForCustomer

The fully constructed url:

URL Example - Single Shipment
https://cloudconnect.Proteria.com/Templates/GetTemplatesForCustomer

Pick-Up Point API:

 GET /pickuppoint/GetPickUpPoints/{countryCode}/{postCode}/{carrier}

GET /pickuppoint/GetPickUpPoints/{countryCode}/{postCode}/{carrier}

This action returns a list of pick-up points close to the postcode that was sent to this action. Must contain country code, postcode and name of carrier.
Max 5 results.

  • The "countryCode" field:

  • The "postCode" field:

    • Must contain the value of a valid and existing post code.

    • Post code must exist in the country chosen in field countryCode.

  • The "carrier" field:

    • Must have the name of a carrier supported by Proteria.

    • As of Desember 2017, these are:

      • Bring

      • PostNord

  • The "street" field (optional):

    • Must be a valid street name.

    • Street name must exist in the post code chosen in field postCode.

  • The "streetNumber" field (optional):

    • Should be a valid street number.

The url must be constructed using this format, although street and streetNumber are optional fields:

URL Pattern
https://cloudconnect.Proteria.com/pickuppoint/GetPickUpPoints/{countryCode}/{postCode}/{carrier}/{street}/{streetNumber}

Replace {countryCode} with a valid ISO2 country code, {postCode} with a valid and existing postcode, and {carrier} with the name of a carrier supported in the Proteria systems.  

Replace {street} with a valid street name in the currently selected {postCode}.

For example, is you call this action with country code NOpost code 9991 and carrier Bring

URL Example
https://cloudconnect.Proteria.com/pickuppoint/GetPickUpPoints/NO/9991/Bring

Result:

JSON response
{
    "pickUpPoints": [
        {
            "id": "127390",
            "name": "Extra Båtsfjord",
            "address": "HAVNEGATA 2",
            "postcode": "9990",
            "city": "BÅTSFJORD",
            "countryCode": "NO",
            "latitude": 70.637387041799,
            "longitude": 29.726844386049567
        },
        {
            "id": "127373",
            "name": "Matkroken Berlevåg",
            "address": "STORGATA 7",
            "postcode": "9980",
            "city": "BERLEVÅG",
            "countryCode": "NO",
            "latitude": 70.85703147746338,
            "longitude": 29.086313368005154
        },
		. . . 
    ]
}

 GET /pickuppoint/GetParcelBoxPoints/{carrier}/{countryCode}/{postCode}

GET /pickuppoint/GetParcelBoxPoints/{carrier}/{countryCode}/{postCode}

This action returns a list of parcel boxes close to the postcode that was sent to this action. Must contain name of carrier, country code, and postcode.

  • The "carrier" field:

    • Must have the name of a carrier supported by Proteria.

    • As of Desember 2017, these are:

      • Bring

      • PostNord

  • The "countryCode" field:

  • The "postCode" field:

    • Must contain the value of a valid and existing post code.

    • Post code must exist in the country chosen in field countryCode.

The url must be constructed using this format, although street and streetNumber are optional fields:

URL Pattern
https://cloudconnect.Proteria.com/pickuppoint/GetParcelBoxPoints/{countryCode}/{postCode}/{street?}/{streetNumber}

Replace {countryCode} with a valid ISO2 country code, {postCode} with a valid and existing postcode, and {carrier} with the name of a carrier supported in the Proteria systems.  

Replace {street} with a valid street name in the currently selected {postCode}.

For example, is you call this action with carrier Bring, country code NOpost code 1712

URL Example
https://cloudconnect.Proteria.com/pickuppoint/GetParcelBoxPoints/BRING/NO/1712/

Result:

JSON response
{
    "pickUpPoints": [
        {
            "id": "113284",
            "name": "Pakkeboks Asvo Bruktmarked",
            "address": "GRÅLUMVEIEN 192",
            "postcode": "1712",
            "city": "GRÅLUM",
            "countryCode": "NO",
            "latitude": 59.285832499102114,
            "longitude": 11.058674538778082
        },
        {
            "id": "110428",
            "name": "Pakkeboks Esso Grålum",
            "address": "BJØRNSTADVEIEN 10",
            "postcode": "1712",
            "city": "GRÅLUM",
            "countryCode": "NO",
            "latitude": 59.295096557260848,
            "longitude": 11.065633980094994
        },
        ...
    ]
}

 GET /pickuppoint/GetMannedPickupPoints/{carrier}/{countryCode}/{postCode}

GET /pickuppoint/GetMannedPickupPoints/{carrier}/{countryCode}/{postCode}

This action returns a list of manned pickup points close to the postcode that was sent to this action. Must contain name of carrier, country code, and postcode.

  • The "carrier" field:

    • Must have the name of a carrier supported by Proteria.

    • As of Desember 2017, these are:

      • Bring

      • PostNord

  • The "countryCode" field:

  • The "postCode" field:

    • Must contain the value of a valid and existing post code.

    • Post code must exist in the country chosen in field countryCode.

The url must be constructed using this format, although street and streetNumber are optional fields:

URL Pattern
https://cloudconnect.Proteria.com/pickuppoint/GetMannedPickupPoints/{carrier}/{countryCode}/{postCode}/{street?}/{streetNumber}

Replace {countryCode} with a valid ISO2 country code, {postCode} with a valid and existing postcode, and {carrier} with the name of a carrier supported in the Proteria systems.  

Replace {street} with a valid street name in the currently selected {postCode}.

For example, is you call this action with carrier Bring, country code NOpost code 1712

URL Example
https://cloudconnect.Proteria.com/pickuppoint/GetMannedPickupPoints/BRING/NO/1712/

Result:

JSON response
{
    "pickUpPoints": [
        {
            "id": "121518",
            "name": "Extra Grålum",
            "address": "VESTERHEIMVEIEN 2",
            "postcode": "1712",
            "city": "GRÅLUM",
            "countryCode": "NO",
            "latitude": 59.294283208743941,
            "longitude": 11.064603165110883
        },
        {
            "id": "121635",
            "name": "Extra Tune",
            "address": "LILLETUNEVEIEN 3",
            "postcode": "1711",
            "city": "SARPSBORG",
            "countryCode": "NO",
            "latitude": 59.287693555888843,
            "longitude": 11.082480232984947
        },
        ...
    ]
}

Shipment API

 POST /shipment/CreateShipments

POST /shipment/CreateShipments

With this action, you can create one or more shipments in our systems.

The JSON must be inside the "Body" of the request, and the header "Content-Type" should be set to "application/json".

  • All values are strings.

  • Field "AutoSendShipments":

    • If this field is set to true, the shipments created will automatically sent to the transporter, such as Bring, PostNord, etc, if the shipment is valid. 

    • This option will be applied to all the shipments sent with the HTTP request. 

  • Field "AutoPrint":

    • If this field is set to true, the shipments created will automatically send a print job to a printer after the label has been created.

    • The printers in the users Cloud Print-settings in Proteria Freight will be used.  

    • This option will be applied to all the shipments sent with the HTTP request. 

  • Field “DefaultTemplateId”:

    • Optional field.

    • Set the id of the template you want to use on all shipments in the call if none other are specified on the shipment.

    • Use the method /Templates/GetTemplatesForCustomer for a complete list of possible template ids.

  • Field "Webhooks":

    • Fill the fields inside Webhooks with links to scripts you want us to sendt HTTP requests to with updated information regarding your shipments,
      such as when they have been validated, if the label is ready, and the tracking status of a shipment. See section Webhooks for more information
      about the data in the HTTP requests sent to the webhook links.

  • Field "Shipments":

    • Array of shipments.

    • Must contain at least one shipment item.

    • Field "OrderId":

      • Optional, but good to have for sorting and getting shipments later. 

    • Field "ShipmentId":

      • Required.

      • This field must be set to ensure that the customer has an id to get the status of the shipment and the label of a shipment in later HTTP calls. 

    • Field “TemplateId”:

      • Optional.

      • If a template id is set in this field, it will override the default template.

      • Use the method /Templates/GetTemplatesForCustomer for a complete list of possible template ids.

      • Use id “NO_TEMP” to completely omit using a template on this shipment

    • The "Delivery", "Sender" and "ReturnTo" fields:

      • The "Delivery" field is related to the the person/entity that will receive the order/package.

      • The "ReturnTo" filed is the actor/entity that will receive the return-package. Use the same information for the Sender and ReturnTo fields if the two entities are identical.

      • "IsCompany" is optional, but we can provide a better validation if this value is set, and issues such as those regarding mismatches between the
        package type and the Delivery-entity can be avoided (e.g. a package type only sends to companies, etc).  

      • You must fill the required fields.

      • If the there is no street address (just postbox), then use the postbox/zip-code in the Address1 field.  

      • The "Country" field:

      • The "ContactPerson" field:

        • Required. 

        • A contact person must have a Name.

        • A contact person must have a PhoneNumber.

        • Email is optional.

    • Field "PackageType"

      • This field must be set to ensure an automated process from creating on order with this http request, to creating a shipment at Proteria Frakt.

      • If this value is not set, the user must go to the Proteria Frakt interface and search and import orders individually.

      • Use the method /ShippingMethods/GetShippingMethodsForCustomer for a complete list of possible package type ids.

    • Field "GenerateReturn":

      • The value of this field will determine if a return-label is created right after the original consignment has been sent.

      • Value must be true or false, i.e boolean values.

      • The return-label will have it's own shipmentId, which will follow this format: RETURN_ORIGINAL-SHIPMENT-ID. E.g. if a shipmentId is SH123, then the shipmentId of the return-label will be RETURN_SH123. 

    • Field "PickUpPointId": 

      • We use the term PickUpPoint to refer to the place where the customer must pick up their package. 

      • Is used for package types that required the customer to pick up their package, such as PostNord MyPack Collect.

      • PostNord ServicePoint is also a PickUpPoint.

      • The Id of a pickup point can be aquired by using our PickUpPoint API.

      • Must contain a valid PickUpPoint Id. 

    • Field "CashOnDelivery":

      • This field is optional, but if used must contain either "KID" OR "Message". Both can not have a value, and both can not be empty. The remaining fields are required. 

      • The field "Amount" must be above 1.

      • The filed "AccountNumber" must be set. Shipments containing invalid account numbers will still be created, but must be corrected before officially sending the shipment to a transporter. 

    • Field "Services":

      • An array of strings.

      • Each string contains the name/id of the service you want.

      • Valid and supported names/ids are found in the GetShippingMethodsForCustomer method. 

    • Field "SendAutoMailShipmentInfoToReceiver":

      • This field is optional, and will default to false.

      • If true will send tracking info to receiver by mail

      • Will use the email template created on web.Proteria.com or a default template if not created.

    • Field "SendTrackingInfoSMSToReceiver":

      • This field is optional, and will default to false.

      • If true will send tracking info to receiver by SMS

    • Field "DeliveryInstruction":

      • This field is optional.

      • Contains any specific instructions regarding the delivery.

    • Field "Parcels":

      • Array of parcels.

      • Fields "LengthCM", "WidthCM" and "HeightCM" are integers, "WeightKG" is a decimal, and "Reference" is a string. 

The values for "PackageType", "CashOnDelivery" and "Services" are optional.

The JSON must look like this:

JSON request
{
	"AutoSendShipments": false,								/* Required, Set to true to automatically send valid shipments */
	"AutoPrint": false,										/* Requiered, set to true to automatically print when label is ready */
	"DefaultTemplateId": "templateid-1",						/* Optional, set to use a template on all shipments in call, unless the shipment has set its own template */
	"Webhooks": {
  		"ShipmentReceived":"",
  		"ValidationStatus":"",
		"BookingOk":"",
		"BookingFailed":"",
		"LabelAvailable":"",
		"TrackingStatus":"",
		"PrintFailed":""
  	},
	"Shipments": [											/* Required, and must have at least one shipment */
		{
			"OrderId": "OR123",								/* Optional */
			"ShipmentId": "SH123123",						/* Required */
			"TemplateId": "template-22",						/* Optional */
			"Sender": {
				"Name": "Ole Brum",							/* Required */
				"Address1": "Hundremeterskogen 100",		/* Required */
				"Address2": null,
				"PostCode": "0100",							/* Required */
				"City": "Hundremeterskogen",				/* Required */
				"Country": "HM",							/* Required */
				"ContactPerson": {
					"Name":"Jan Teigen",
					"Email": null,
					"PhoneNumber": "12345678"
				}
			},
			"Delivery": {
				"IsCompany": true,							/* Optional, set this to avoid validation errors regarding mismatch with package type */
				"Name": "Hercules",							/* Required */
				"Address1": "Olympusveien 10",				/* Required */
				"Address2": null,	
				"PostCode": "2020",							/* Required */
				"City": "Athen",							/* Required */
				"Country": "GR",							/* Required */
				"ContactPerson": {
					"Name":"Jan Teigen",
					"Email": null,
					"PhoneNumber": "12345678"				/* Required */
				}
			},
			"ReturnTo": {									/* Optional */
				"IsCompany": true,							/* Optional, set this to avoid validation errors regarding mismatch with package type */
				"Name": "Simba",							/* Required if return-label must be created */
				"Address1": "Fjell 10",						/* Required if return-label must be created */
				"Address2": null,	
				"PostCode": "2020",							/* Required if return-label must be created */
				"City": "Athen",							/* Required if return-label must be created*/
				"Country": "GR",							/* Required if return-label must be created*/
				"ContactPerson": {
					"Name":"Jan Teigen",
					"Email": null,
					"PhoneNumber": "12345678"				/* Required if return-label must be created*/
				}
			},
			"SendersReference": "sr",
			"ReceiversReference": "rr",
			"DeliveryInstruction": "I am a message",		/*Optional, used to give specific instructions for the delivery. */
			"MsgToReceiver": "mtr",
			"PackageType": "1220",
			"GenerateReturn": true,							/* Optional */
			"PickUpPointId": "PUP123",
			"CashOnDelivery": {    						
				"AccountNumber": "12345678999",				/* Required if CashOnDelivery is going to be used */ 
				"Amount": 123.45,							/* Required if CashOnDelivery is going to be used */ 
				"Message": "I am message.",					/* Required if CashOnDelivery is going to be used. Must be empty if "KID" is going to be used. */
				"KID": "I am KID."							/* Required if CashOnDelivery is going to be used. Must be empty if "Message" is going to be used. */
			},
			"Services": [								
				"service_evarsling",
				"service_cod",
				. . .
			],				
			"SendAutoMailShipmentInfoToReceiver": false,
			"SendTrackingInfoSMSToReceiver": false,		
			"Parcels": [
				{
					"LengthCM": 12,
					"WidthCM": 34,
					"HeightCM": 56,
					"WeightKG": 123.45,
					"Reference": "I am reference"
				},
				. . .
			]
		},
		. . .
	]
}

If successful, you will get this response:

JSON response
"Success: X"

X will equal the amount of shipments successfully created. 

 POST /shipment/CreateShipmentsForOrder

POST /shipment/CreateShipmentsForOrder

With this action, you can create one or more shipments to an order that has previously been created/placed in our systems. In other words, you must have run "POST /CreateNewOrder" before you can run this action.

This action uses the orderid of an order that already exists in our systems, and this orderid will be used to connect a shipment to an order. 

The JSON must be inside the "Body" of the request, and the header "Content-Type" should be set to "application/json".

  • All values are strings.

  • Field "OrderId":

    • This OrderId is the one that the user has given to an order in their respective systems.

    • This field is required, and must be the orderid of an order previously uploaded to the system. 

    • All the shipments in this HTTP action will be connect to the order with id OrderId. 

  • Field "AutoSendShipments":

    • If this field is set to true, the shipments created will automatically sent to the transporter, such as Bring, PostNord, etc, if the shipment is valid. 

    • This option will be applied to all the shipments sent with the HTTP request. 

  • Field "AutoPrint":

    • If this field is set to true, the shipments created will automatically send a print job to a printer after the label has been created.

    • The printers in the users Cloud Print-settings in Proteria Freight will be used.  

    • This option will be applied to all the shipments sent with the HTTP request. 

  • Field “DefaultTemplateId”:

    • Optional field.

    • Set the id of the template you want to use on all shipments in the call if none other are specified on the shipment.

    • Use the method /Templates/GetTemplatesForCustomer for a complete list of possible template ids.

  • Field "Webhooks":

    • Fill the fields inside Webhooks with links to scripts you want us to sendt HTTP requests to with updated information regarding your shipments,
      such as when they have been validated, if the label is ready, and the tracking status of a shipment. See section Webhooks for more information
      about the data in the HTTP requests sent to the webhook links.

  • Field "Shipments":

    • Array of shipments.

    • Must contain at least one shipment item.

    • Field "ShipmentId":

      • Required.

      • This field must be set to ensure that the customer has an id to get the status of the shipment and the label of a shipment in later HTTP calls. 

    • Field “TemplateId”:

      • Optional.

      • If a template id is set in this field, it will override the default template.

      • Use the method /Templates/GetTemplatesForCustomer for a complete list of possible template ids.

      • Use id “NO_TEMP” to completely omit using a template on this shipment

    • Field "PackageType"

      • This field must be set to ensure an automated process from creating on order with this http request, to creating a shipment at Proteria Frakt.

      • If this value is not set, the user must go to the Proteria Frakt interface and search and import orders individually.

      • Use the method /ShippingMethods/GetShippingMethodsForCustomer for a complete list of possible package type ids.

    • Field "PickUpPointId": 

      • We use the term PickUpPoint to refer to the place where the customer must pick up their package. 

      • Is used for package types that required the customer to pick up their package, such as PostNord MyPack Collect.

      • PostNord ServicePoint is also a PickUpPoint.

      • The Id of a pickup point can be aquired by using our PickUpPoint API.

      • Must contain a valid PickUpPoint Id. 

    • Field "CashOnDelivery":

      • This field is optional, but if used must contain either "KID" OR "Message". Both can not have a value, and both can not be empty. The remaining fields are required. 

      • The field "Amount" must be above 1.

      • The filed "AccountNumber" must be set. Shipments containing invalid account numbers will still be created, but must be corrected before officially sending the shipment to a transporter. 

    • Field "Services":

      • An array of strings.

      • Each string contains the name/id of the service you want.

      • Valid and supported names/ids are found in the GetShippingMethodsForCustomer method.

    • Field "SendAutoMailShipmentInfoToReceiver":

      • This field is optional, and will default to false.

      • If true will send tracking info to receiver by mail

      • Will use the email template created on web.Proteria.com or a default template if not created.

    • Field "SendTrackingInfoSMSToReceiver":

      • This field is optional, and will default to false.

      • If true will send tracking info to receiver by SMS

    • Field "DeliveryInstruction":

      • This field is optional.

      • Contains any specific instructions regarding the delivery.

      • Will overwrite any delivery instructions placed on the creation of the order

      • Set value to null to use the one set on the creation of the order

    • Field "Parcels":

      • Array of parcels.

      • Fields "LengthCM", "WidthCM" and "HeightCM" are integers, "WeightKG" is a decimal, and "Reference" is a string. 

The values for "PackageType", "PickUpPointId", "CashOnDelivery" and "Services" are optional, however if they are set, the will override the corresponding values in the order. This means that
if you set the value for, for example, "PackageType" to 1100 in the "POST /CreateNewOrder" call, and set the value for "PackageType" in one of the shipments to 5555 in the "POST /CreateShipmentsForOrder" call,
then 5555 is the value for "PackageType" that will be used for that specific shipment. If the "PackageType" field is left empty, the shipment will use the "PackageType" found in the order.

The JSON must look like this:

JSON request
{
	"OrderId": "1001",									/* Required */
	"AutoSendShipments": false,							/* Required, Set to true to automatically send valid shipments */
	"AutoPrint": false,										/* Requiered, set to true to automatically print when label is ready */
	"DefaultTemplateId": "templateid-1",						/* Optional, set to use a template on all shipments in call, unless the shipment has set its own template */
	"Webhooks": {
  		"ShipmentReceived":"",
  		"ValidationStatus":"",
		"BookingOk":"",
		"BookingFailed":"",
		"LabelAvailable":"",
		"TrackingStatus":"",
		"PrintFailed":""
  	},
	"Shipments": [										/* Required, and must have at least one shipment */
		{
			"ShipmentId": "SH123123",					/* Required */
    		"TemplateId": "template-22",				/* Optional */
			"SendersReference": "sr",
			"ReceiversReference": "rr",
			"DeliveryInstruction": "I am a message",	/*Optional, used to give specific instructions for the delivery. */
			"MsgToReceiver": "mtr",
			"PackageType": "1220",
			"PickUpPointId": "PUP123",					
			"CashOnDelivery": {    						
				"AccountNumber": "12345678999",			/* Required if CashOnDelivery is going to be used */ 
				"Amount": 123.45,						/* Required if CashOnDelivery is going to be used */ 
				"Message": "I am message.",				/* Required if CashOnDelivery is going to be used. Must be empty if "KID" is going to be used. */
				"KID": "I am KID."						/* Required if CashOnDelivery is going to be used. Must be empty if "Message" is going to be used. */
			},
			"Services": [								
				"service_evarsling",
				"service_cod",
				. . .
			],
			"SendAutoMailShipmentInfoToReceiver": false,
			"SendTrackingInfoSMSToReceiver": false,			
			"Parcels": [
				{
					"LengthCM": 12,
					"WidthCM": 34,
					"HeightCM": 56,
					"WeightKG": 123.45,
					"Reference": "I am reference"
				},
				. . .
			]
		},
		. . .
	]
}

Label API

 POST /label/GetLabel/{printFormat}

POST /label/GetLabel/{printFormat}

This action gets the label(s) of the shipment(s) within the shipmentIds parameter in the HTTP request body JSON, and returns it in the format specified by the parameter printFormat.
The shipmentIds parameter in the JSON must contain (an) id(s) of a shipment previously created through the CreateShipment-action in the API,
hence the shipmentId(s) will be the id(s) that the user has set for the shipment(s) in their own systems.

Return labels fetched when IncludeReturnLabel is set to true must be created through the CreateShipment action with the GenerateReturn flag set to true.


A maximum of 100 shipment ids allowed per request. 

URL Pattern:

URL Format
/label/GetLabel/{printFormat}


Replace {printFormat} with the format of the label you want, and attach the id(s) of the shipment(s).
Valid values for printFormat are: A4 and Label, where the latter is optimized to fit into thermal-printers. 

This is a sample of a JSON that must be sent with the request (For more labels, add to ids to the array below):

JSON Request - Single Shipment
{
	"shipmentids": [
		"SH1525780262_96_6"
	],
	"IncludeReturnLabel": false //Optional. Set to true to fetch return label if available. Return label must be generated to be fetched
}

For multiple shipments: 

JSON Request - Multiple Shipments
{
	"shipmentids": [
		"SH1525780262_96_6",
		"SH123_123_123"
	],
	"IncludeReturnLabel": false //Optional. Set to true to fetch return label if available. Return label must be generated to be fetched
}

If you call this action with the JSON above and printFormat Label: https://cloudconnect.Proteria.com/label/GetLabel/Label,

You will either be promped to download the returned label, or it will open up in a new tab in your browser. Calls with single or multiple shipmentIds will always 
result in one single pdf, which contains all the labels of the shipments stated in the url. (Return type: FileStreamResult)

Order API

 POST /order/CreateNewOrder

POST /order/CreateNewOrder

With this action, you can create/upload an order in our systems by sending us a JSON containing your order. 

The JSON must be inside the "Body" of the request, and the header "Content-Type" should be set to "application/json".

  • All values are strings.

  • Field "OrderId":

    • This OrderId is the one that the user has given to the order in their respective systems.

    • This field is required, and must be unique to the order. This means that the order must have an order id that has not been used previously. 

  • The "Receiver""Delivery" and "ReturnTo" fields:

    • The fields within the "Receiver" field are related to the person/entity that will pay for the order.

    • The "Delivery" fields are related to the the person/entity that will receive the order/package.

    • The "ReturnTo" filed is the actor/entity that will receive the return-package. Use the same information for the Sender and ReturnTo fields if the two entities are identical.

    • "IsCompany" is optional, but we can provide a better validation if this value is set, and issues such as those regarding mismatches between the
      package type and the Delivery-entity can be avoided (e.g. a package type only sends to companies, etc).  

    • If these to are set to the same person/entity in your order, the field for "Receiver" and "Delivery" can be equal, i.e. they represent the same entity, thus they can be identical.

    • The "Country" field:

    • The "ContactPerson" field:

      • Required. 

      • A contact person must have a Name.

      • A contact person must have a PhoneNumber.

      • Email is optional.

    • You must fill the required fields, as stated in the point above. 

  • Field "PackageType":

    • This field must be set to ensure an automated process from creating on order with this http request, to creating a shipment at Proteria Frakt.

    • If this value is not set, the user must go to the Proteria Frakt interface and search and import orders individually.

    • Use the method /ShippingMethods/GetShippingMethodsForCustomer for a complete list of possible package type ids.

  • Field "PickUpPointId": 

    • We use the term PickUpPoint to refer to the place where the customer must pick up their package. 

    • Is used for package types that required the customer to pick up their package, such as PostNord MyPack Collect.

    • PostNord ServicePoint is also a PickUpPoint.

    • The Id of a pickup point can be aquired by using our PickUpPoint API.

    • Must contain a valid PickUpPoint Id. 

  • Field "InvoiceNumber":

    • InvoiceNumber the number of the invoice related to this order, in the users systems.

    • This field can be set to NULL is there is no InvoiceNumber. 

  • Field "DeliveryInstruction":

    • This field is optional.

    • Contains any specific instructions regarding the delivery.

  • Fields "OrderCreationDate":

    • This field must have a string that matches this format: "dd/mm/yyyy hh:mm:ss.ms", where dd/mm/yyyy is short for day/month/year, and hh:mm:ss.ms is short for hour:minute:seconds.milliseconds. 

  • Field "InvoiceCreatedAt"

    • This field must have a string that matches this format: "dd/mm/yyyy hh:mm:ss.ms", where dd/mm/yyyy is short for day/month/year, and hh:mm:ss.ms is short for hour:minute:seconds.milliseconds.

  • Field "CurrencyCode":

    • Must be exactly three letters, all uppercase, and can only contain letters from A to Z

    • For more information about valid currency codes, etc, visit this page: http://www.xe.com/iso4217.php .

  • Field "IncoTerm":

  • Field "CashOnDelivery":

    • This field is optional, but if used must contain either "KID" OR "Message". Both can not have a value, and both can not be empty. The remaining fields are required. 

    • The field "Amount" must be above 1.

    • The filed "AccountNumber" must be set. Shipments containing invalid account numbers will still be created, but must be corrected before officially sending the shipment to a transporter. 

  • Field "Services":

    • An array of strings.

    • Each string contains the name/id of the service you want.

    • Valid and supported names/ids are found in the GetShippingMethodsForCustomer method.

  • Field "OrderLines":

    • Array of orderlines.

    • Fields "Description""ArticleNumber", "CustomsTariffNumber", "DangerousGoods", "CountryOfOrigin" and "ProvinceOfOrigin" are strings, while the rest are all decimals. 

    • Field "Description":

    • Field "ArticleNumber":

    • Field "CustomsTariffNumber":

    • Field "Quantity":

      • The quantity, i.e. how many of the same item sold/part of the same orderline.

      • Must be more than zero.

    • Field "DangerousGoods":

      • Accepts values of exactly four or six letters.

      • In the case of a four character string:

        • The string must only contain digits, e.g. 1234.

      • In the case of a six character string:

        • The string must contain the letters UN follwed by exactly four digits, e.g. UN1234.

        • Any string missing the UN affix will result in an error. 

      • For more information about dangerous goods and which value to use for this field, go to this page: https://en.wikipedia.org/wiki/Lists_of_UN_numbers .

    • Field "CountryOfOrigin":

    • Field "ProvinceOfOrigin":

    • Field "VATRate":

      • Specifies how many percent the VAT amounts to.


The JSON must look like this:

JSON request
{
	"Sender": {
		"Name": "Ole Brum",						/* Required */
		"Email": null,
		"PhoneNumber": null,
		"Address1": "Hundremeterskogen 100",	/* Required */
		"Address2": null,
		"PostCode": "0100",						/* Required */
		"City": "Hundremeterskogen",			/* Required */
		"Country": "HM",						/* Required */
		"ContactPerson": {
			"Name":"Jan Teigen",
			"Email": null,
			"PhoneNumber": "12345678"
		}
	},
	"Receiver": {
		"Name": "Aladdin",					/* Required */
		"Email": null,
		"PhoneNumber": "12345678",			/* Required */
		"Address1": "Agrabaveien 10",		/* Required */
		"Address2": null,
		"PostCode": "1010",					/* Required */
		"City": "Agraba",					/* Required */
		"Country": "AG",					/* Required */
		"ContactPerson": {
			"Name":"Jan Teigen",
			"Email": null,
			"PhoneNumber": "12345678"
		}
	},
	"Delivery": {
		"IsCompany": true,					/* Optional, set this to avoid validation errors regarding mismatch with package type */
		"Name": "Hercules",					/* Required */
		"Email": null,
		"PhoneNumber": "12345678",			/* Required */
		"Address1": "Olympusveien 10",		/* Required */
		"Address2": null,	
		"PostCode": "2020",					/* Required */
		"City": "Athen",					/* Required */
		"Country": "GR",					/* Required */
		"ContactPerson": {
			"Name":"Jan Teigen",
			"Email": null,
			"PhoneNumber": "12345678"
		}
	},
	"ReturnTo": {									/* Optional */
		"IsCompany": true,							/* Optional, set this to avoid validation errors regarding mismatch with package type */
		"Name": "Simba",							/* Required if return-label must be created */
		"Address1": "Fjell 10",						/* Required if return-label must be created */
		"Address2": null,	
		"PostCode": "2020",							/* Required if return-label must be created */
		"City": "Athen",							/* Required if return-label must be created*/
		"Country": "GR",							/* Required if return-label must be created*/
		"ContactPerson": {
			"Name":"Jan Teigen",
			"Email": null,
			"PhoneNumber": "12345678"				/* Required if return-label must be created*/
		}
	},
	"OrderId": "1001",								/* Required, and must be unique */
	"OrderCreationDate": "07/07/2007 7:7:7.7",
	"DeliveryInstruction": "Delivery instructions",
	"PackageType": "1220",							/* Required */
	"PickUpPointId": "PUP123",
	"InvoiceNumber": null,
	"InvoiceCreatedAt": "08/08/2008 8:8:8.8",
	"CurrencyCode": "NOK",
	"IncoTerm": "nuk",
	"CashOnDelivery": {    						
		"AccountNumber": "12345678999",				/* Required if CashOnDelivery is going to be used */ 
		"Amount": 123.45,							/* Required if CashOnDelivery is going to be used */ 
		"Message": "I am message.",					/* Required if CashOnDelivery is going to be used. Must be empty if "KID" is going to be used. */
		"KID": "I am KID."							/* Required if CashOnDelivery is going to be used. Must be empty if "Message" is going to be used. */
	},
	"Services": [ 
		"service_evarsling",
		"service_cod",
		. . .
	],
	"OrderLines": [
		{
			"Description": "I am description.",		/* Required if OrderLines is going to be used */
			"ArticleNumber": null,
			"CustomsTariffNumber": "123456",
			"Quantity": 1.0,						/* Required if OrderLines is going to be used */
			"DangerousGoods": "1234",				/* Not required, but must be 4 digits or UN plus four digits, e.g. 1234 or UN1234 */ 
			"CountryOfOrigin": "he",
			"ProvinceOfOrigin": null,
			"UnitPriceExcludingVAT": 0.0,
			"UnitPriceIncludingVAT": 0.0,
			"TotalPriceExcludingVAT": 0.0,
			"TotalPriceIncludingVAT": 0.0,
			"VATAmount": 0.0,
			"VATRate": 0.0,
			"UnitGrossWeightKG": 0.0,
			"TotalGrossWeightKG": 0.0,
			"UnitNetWeightKG": 0.0,
			"TotalNetWeightKG": 0.0
		},
		. . .
	],
	"OrganizationNumber": null,
	"VATNumber": 0.0,
	"VATAmount": 0.0,
	"VATRate": 0.0,
	"TotalPriceExcludingVAT": 0.0,
	"TotalPriceIncludingVAT": 0.0
}


Print API

 GET /print/GetPrinters

GET /print/GetPrinters

URL Format
/print/GetPrinters


Example Result:

JSON response
{
	{
        "Id": "12345",
        "Name": "PrinterName",
        "State": "online"
    },
    {
        "Id": "67890",
        "Name": "PrinterName",
        "State": "offline"
    },
    . . . 
}


 POST /print/Print

POST /print/Print

This action print the label(s) of shipment(s) within the shipmentIds parameter, by sending a print job to the either
the default printers specified for A4, Label, RFID and PiPLabel, (default printers set in Frakt Web Settings)
or the printer with id matching the value of the printerId parameter.


THIS REQUIRES AN ACTIVATED Proteria CLOUD PRINT ACCOUNT.
More about Cloud Print: https://www.Proteria.no/Proteria-frakt/Proteria-frakt-web/skrivere-og-etiketter/


The shipmentIds parameter must contain (an) id(s) of a shipment previously created through the CreateShipment-action in the API,
hence the shipmentId(s) will be the id(s) that the user has set for the shipment(s) in their own systems.

The fields inside the Printers field, namely A4PrinterId, LabelPrinterId, RFIDPrinterId and PiPPrinterId parameters must contain the id of a printer that is connected to your Proteria Cloud Print Box, thus making it
possible for us to find the printer and send print jobs to it. These ids are used to shipments to the appropriate printers, as each label has a different size and format.

When PrintReturnLabel is set to true, return shipments created with the CreateShipment action and the GenerateReturn flag set to true, will be printed out if available


A maximum of 100 shipment ids allowed per request. 

JSON request
{
	"Printers": {
		"A4PrinterId": "IAmA4",
		"LabelPrinterId": "IAmLabel",
		"RFIDPrinterId": "IAmRFID",
		"PiPPrinterId": "IAmPiPLabel"
	},
	"ShipmentIds": [
		"SH123",
		"SH456",
		..,
	],
	"PrintReturnLabel": false //Set to true to also print out the return label if available
}

URL Pattern:

URL Format
/print/Print


If the printerId parameters above are set to null, our system will use the default printers selected by the user on our website
under the Cloud Print settings.

The fully constructed url:

URL Example - Single Shipment
https://cloudconnect.Proteria.com/print/Print


(thumbs up) Webhooks

There are a couple of webhooks that should be implemented to ensure a seamless experience to the users. 
These webhooks are:

Remember to provide a link/url/address to a script that we can send HTTP-request to regarding each of the webhooks listed above.
These are necessary, as we will be sending information about each of these events to these endpoints/urls/links. 

Example:
After you have sent a HTTP-request to cloudconnect.Proteria.com/shipments/CreateShipment with a json containing data of your shipments,
and a link to a script in the ShipmentReceived-field, then we will send an HTTP-request to this link once we have received your request to notify
you that we have received that shipment. 

ShipmentReceived webhook

We will send the shipmentId of a shipment that we successfully received to this link/url/address. 

A request is sent for each shipment received.

The data that we send in the HTTP-request body will look like the following:

JSON structure
{
	"Shipmentid": "A_SHIPMENT_ID"
}

ValidationStatus webhook

We will send the shipmentId of a shipment that we have validated to this link/url/address. 

A request is sent for each shipment validated.

The data that we send in the HTTP-request body will look like the following:

JSON structure
{
	"Shipmentid": "A_SHIPMENT_ID",
	"Valid": true
}

Field valid can be either true or false.

BookingOk webhook

We will send the shipmentId, tracking number and tracking url of a shipment that has been successfully booked at the transporter to this link/url/address. 

A request is sent for each shipment successfully booked.

The data that we send in the HTTP-request body will look like the following:

JSON structure
{
	"Shipmentid": "A_SHIPMENT_ID",
	"Trackingnumber": "A_TRACKING_NUMBER",
	"Trackingurl": "A_TRACKING_URL"
}

BookingFailed webhook

We will send the shipmentId of a shipment that failed to get booked at the transporter to this link/url/address. 

A request is sent for each shipment that failed to get booked.

The data that we send in the HTTP-request body will look like the following:

JSON structure
{
	"Shipmentid": "A_SHIPMENT_ID"
}

LabelAvailable webhook

We will send the shipmentId of a shipment that has a label available for printing to this link/url/address. 

A request is sent for each shipment that has a label available.

The data that we send in the HTTP-request body will look like the following:

JSON structure
{
	"Shipmentid": "A_SHIPMENT_ID"
}

TrackingStatus webhook

We will send the shipmentId, tracking number, tracking url and status of a shipment every time we receive
a updated tracking information regarding the shipment to this link/url/address. 

A request is sent for each tracking update.

The data that we send in the HTTP-request body will look like the following:

JSON structure
{
	"Shipmentid": "A_SHIPMENT_ID",
	"Status": "A_STATUS",
	//Possible status codes:
	//	None = 0,
    //  PartiallySubmitted = 1,
    //  Submitted = 2,        
    //  PartiallyDelivered = 4,
    //  Delivered = 5
	"Trackingnumber": "A_TRACKING_NUMBER",	
	"Trackingurl": "A_TRACKING_URL"
}

PrintFailed webhook

We will send the shipmentId of a shipment that failed to print to this link/url/address. 
A request is sent for each shipment that failed to print.

The data that we send in the HTTP-request body will look like the following:

JSON structure
{
	"Error": "AN_ERROR_MSG",
	"Shipmentid": "A_SHIPMENT_ID"
}


(minus) Errors

Error code

Message

E1001

Token does not have CompanyId. User is either not logged in or does not have access to CloudConnect API. Might not have token.

E1002

User did not send an order with the request, thus making it impossible to create a new order. JSON of order must be added to the body of the HTTP request.

E1003

The order the user sent in his HTTP request did not contain required filed "OrderId".

E1003-S

The shipment creation action did not receive an "OrderId".

E1004

The field "OrderId" in the order that was sent in the HTTP request does not contain a unique orderId. OrderId has been used before. Please use another OrderId.

E1005

Upload of new order/shipment failed when trying to save the order/shipment. Please contact Proteria for help.

E1006

Unexpected error when saving order or sending JSON response. Please contact Proteria for help.

E1007

The orderid that was sent with the action is not the orderid of an existing order in our system. Please run the "POST /CreateNewOrder" action to create an order, and then proceed to create shipments using the orderid of the created order.

E1008

Unexpected error when trying to start creation of shipments. Please contact Proteria for help.

E1009

The "CashOnDelivery" field was missing one or more fields, or had both the "KID" and "Message" fields set. Remember the all values here must be set, and that you can ONLY have a values in "KID" OR "Message". If both fields have value, it will result in an error, and an error will also occur if both fields do not contain a value. The field "Amount" can not be less than 1. 

E1010

One or more of the required fields in "POST /CreateNewOrder" were empty or null. Please check if these were sent with the HTTP request. Remember that if "receiver" and "delivery" are the identical (think of "receiver" as the entity you send the invoice too, and "delivery" as the entity the shipment will be sent to), you must write the same values for both the "receiver" and "delivery" fields.

E1011

The field "PackageType" contained an invalid or unsupported id for package type. Please use the method /ShippingMethods/GetShippingMethodsForCustomer for a complete list of possible package type ids.

E1012

The field "Services" containded an id that is not valid. Please use the id of a service that is supported. See description above for valid services.

E1013

Currency code must be exactly three letters, all uppercase, and can only contain letters from A to Z

E1014

Fields "Description" and "Quantity" were either missing values or had invalid values. Fields "Description" and "Quantity" must be set per item inside field "OrderLine". Quantity must also be over zero. 

E1015

Date format wrong. Field "OrderCreationDate" must have the format "dd/mm/yyyy hh:mm:ss.ms", where dd/mm/yyyy is short for day/month/year, and hh:mm:ss.ms is short for hour:minute:seconds.milliseconds. 

E1016

Date format wrong. Field "InvoiceCreatedAt" must have the format "dd/mm/yyyy hh:mm:ss.ms", where dd/mm/yyyy is short for day/month/year, and hh:mm:ss.ms is short for hour:minute:seconds.milliseconds. 

E1017

Dates for "OrderCreationDate" could not be created. Please contact Proteria for help.

E1018

Date for "InvoiceCreatedAt" could not be created. Please contact Proteria for help.

E1019

Incoterm code must be exactly three letters, all uppercase, and can only contain letters from A to Z

E1020

Field "CountryOfOrigin" must be a valid ISO2 country code.  More on valid ISO2 codes here: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. or here https://www.iso.org/obp/ui/#search/code/ under the column Alpha-2 code.

E1021

Field "CustomsTariffNumber" must be at least six characters.

E1022

Field "DangerousGoods" must be exactly four digits.

E1023

Field "Shipments" was either null or did not contain any shipments. Please add a shipment to this field.

E1024

Field "ShipmentId" was not included in the request. Please include this before sending the HTTP request, as each shipment must have a Shipment Id.

E1025

Field "ShipmentId" did not contain a unique ShipmentId, meaning that a shipment with the same shipment id has previously been uploaded/created. Please change this to a unique Shipment Id.

E1026

Field "PrintFormat" was not included in the requst. The print format must be attached to the end of the url, and cna have the values of A4 or Label. Ex: cloudconnect.Proteria.com/label/SH123/Label. This means that you want a the label of shipment SH123, where the label is optimizied for thermal-printers.

E1027

Field "ShipmentId" contained a shipment id for a shipment that does not, or does not yet, exist in our systems. Please use the id of a shipment that you have previously sent to Proteria via the api.

E1028

Field "countryCode" was not set in the url for the action. The value must be a valid ISO2 country code. More on valid ISO2 codes here: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. or here https://www.iso.org/obp/ui/#search/code/ under the column Alpha-2 code.

E1029

Field "postCode" was not set in the url for the action. Must be a valid and existing post code. For Norwegian Postcodes, look here: https://adressesok.posten.no/nb/postal_codes/search

E1030

Field "carrier" was not set in the url for the action. Must be the name of a carrier supported by Proteria. Check the documentation for the GetPickUpPoints action for valid and supported carriers.

E1031

Field "carrier" does not contain a valid value. Must be the name of a carrier supported by Proteria. Check the documentation for the GetPickUpPoints action for valid and supported carriers.

E1032

Field "countryCode" is not supported by the chosen "carrier". Must be a country code supported by the chosen carrier. See the documentation for the GetPickUpPoints action for valid and supported country codes per carrier.

E1033

Something went wrong during the retrieval of pick-up-points from the carrier. Please contact Proteria for help with this issue.

E1034

Field "shipmentIds" did not contain any ids. Please add at least one id of an existing shipment in this parameter.

E1035

One of the shipmentIds in the field b "shipmentIds" did not contain any value. Please make sure that there are no empty values in the url.

E1036

No pick-up point was found for the chosen postcode/postnumber with the chosen carrier. This could be beause the carrier does not offer service to that area, or because the chosen postcode/postnumber is an invalid/non-existing. 

E1037

The number of shipment ids in the HTTP url exceed the allowed limit, and the request stopped. See the /label/GetLabels action description in the documentation for more information about the limit.

E1038

If the package type of a order or shipment is a "Pakke i Postkassen"/"Small Packet", then Delivery.Email OR Delivery.PhoneNumber is required, since eVarsling is required by the transporter from these products. Please add a phone number or an email to the JSON.

E1039

Field "Waybills" was either null or did not contain any waybills. Please add a waybill to this field.

E1040

Field "SendAutoMailShipmentInfoToReceiver" was true. but Contact person did not have an email address

E1041

Field "SendTrackingInfoSMSToReceiver" was true, but Contact person did not have a phone number

E1042

No pick-up point was found for the chosen address with the chosen carrier. This could be because the address is invalid/doesn't exist.

E1043

No pick-up point was found for the chosen street with the chosen carrier. This could be because the street name is invalid/doesn't exist.

List of United Nation Dangerous Goods Ids

Information related to ISO2 country codes and codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. and https://www.iso.org/obp/ui/#search/code/.

Norwegian province codes.

Currency codes and more info

IncoTerm information and codes

Norwegian post codes







  • No labels