Repository navigation
Sending Requests
Cargonizer has an HTTP REST API.
https://api.cargonizer.no
The path section determines which endpoint and resource type you're working with. For example, the URL
https://api.cargonizer.no/customers
is used to work with the Customers endpoint. Referring to a specific resource is done by adding that resource's ID to the URL:
https://api.cargonizer.no/customers/12345
The HTTP method determines the action you are performing on the endpoint/resource:
| HTTP Method | Action |
|---|---|
| GET | Retrieve a resource |
| POST | Create a resource |
| PATCH | Update a resource |
| DELETE | Delete a resource |
Please include a descriptive User-Agent header in all requests. It should contain the name of your product or company, its version, and a contact address.
User-Agent: AcmeWMS/4.2 (support@acme.com)
This helps us identify your integration, give you faster support if something goes wrong, and contact the right people about changes that may affect you.
If you don't set this header, your HTTP library usually sends a generic default (for example python-requests/2.32.3 or Java/17), which doesn't tell us who you are.
You will encounter two main data formats using our API: XML and JSON. XML will eventually be phased out, and all new endpoints will use JSON.
The format of the response data is specified either by using an extension on the endpoint or by using the Accept header.
GET /customers.xml
GET /customers
Accept: application/xml
When sending data in a POST or PATCH request, the format of that data is specified using the Content-Type header.
POST /customers
Content-Type: application/xml
<customer>
...
</customer>
Combining the two, you specify the format of the data you're sending and the format of the data you will receive.
POST /customers.xml
Content-Type: application/xml
<xml/>
POST /customers
Accept: application/xml
Content-Type: application/xml
<xml/>
| Format | Extension | Media Type |
|---|---|---|
| JSON | .json | application/json |
| XML | .xml | application/xml |
The query string part of the URL can be used to supply parameters that alter the meaning of the request in some way.
GET /customers?country=SE&postcode=55600
Map and list parameters can be supplied using a custom syntax.
Map values are encoded using [ and ]
In the query string
GET /carOfTheYear?car[name]=Volvo+Amazon&car[stats][model]=1959&car[stats][color]=black&car[discontinued]=true
The parameters correspond to this JSON document:
{
"car": {
"name": "Volvo Amazon",
"stats": {
"model": "1959",
"color": "black"
},
"discontinued": "true"
}
}Any parameter, including those in maps, can be specified to be part of a list by adding [] at the end of the name.
GET /carOfTheYear?car[notes][]=three-point+seatbelt&car[notes][]=timeless+beauty
{
"car": {
"notes": [
"three-point seatbelt",
"timeless beauty"
]
}
}