To access most resources, you must be authenticated. Authentication is done using an API key associated with your user account; additionally, many resources require that you tell them which sender you represent. Both the API key and sender ID are passed as custom HTTP headers.
Authenticating your request using your API key
To authenticate your request, you must supply your API key, a long string of numbers and letters (hexadecimal representation of an integer) that you can find by going to the Preferences pane when you're logged into the Cargonizer web interface. This key is associated with your user account and is a secret (treat it like a password).
You need an Cargonizer Account to get access to you API key. Please choose a plan and register first, if that's not the case. If you are a developer you can get a test account in our test enviroment (sandbox) by registering for one here.
The HTTP header containing your API key must be named X-Cargonizer-Key, as in the examples below.
curl -g -XGET -H'X-Cargonizer-Key: 12345' 'https://cargonizer.no/profile.xml'
GET /profile.xml HTTP/1.1 Host: cargonizer.no X-Cargonizer-Key: 12345
http = new HTTPRequest(); http.method = 'GET'; http.url = 'https://cargonizer.no/profile.xml'; http.headers.add('X-Cargonizer-Key', '12345'); response = http.execute();
Supplying a sender ID
In a lot of cases, Cargonizer needs to know which sender you're operating as, as it's possible for one user to have access to more than one sender. When using the API, you supply the sender's ID using an HTTP header just like you supply your API key. You can find a list of sender IDs for your user in the web interface under Preferences, just like your API key.
Note: While we refer to it as a sender ID in this and other documents, the ID you must supply actually represents the relationship between your user and a sender. Thus, the "sender ID" for a sender is different for each of that sender's associated users.
The HTTP header containing the sender ID must be named
curl -g -XGET -H'X-Cargonizer-Key: 12345' -H'X-Cargonizer-Sender: 678' 'https://cargonizer.no/transport_agreements.xml'
GET /transport_agreements.xml HTTP/1.1 Host: cargonizer.no X-Cargonizer-Key: 12345 X-Cargonizer-Sender: 678
http = new HTTPRequest(); http.method = 'GET'; http.url = 'https://cargonizer.no/transport_agreements.xml'; http.headers.add('X-Cargonizer-Key', '12345'); http.headers.add('X-Cargonizer-Sender', '678'); response = http.execute();
Note: For a resource that requires a sender ID, you will also have to supply an API key. All requests that happen in the scope of a sender must be authenticated by a user allowed to act as that sender.