Cost centers API
General:
Basics:
Parameters in the url should all be encoded and all data sent should be UTF-8
MAX number of requests per minute is set to 200.
When the limit is hit an error with code 429 is returned, with the header "Retry-After" containing the number of seconds you have to wait for your next request.
When the limit is hit an error with code 429 is returned, with the header "Retry-After" containing the number of seconds you have to wait for your next request.
Headers:
There are 2 ways to be authenticated when using this API. in both ways you add headers to the request.
1) Use an API-key together with store-id. This would be used when communicating machine to machine and no real person is involved. The API-key is available from where you activated the API. The store-id is also available in the same place.
2) Use a user_id and user_token together with a store-id. You get these values from the login-request. The values are connected to a person and are gained when an actual login to the system has been made.
1) Use an API-key together with store-id. This would be used when communicating machine to machine and no real person is involved. The API-key is available from where you activated the API. The store-id is also available in the same place.
2) Use a user_id and user_token together with a store-id. You get these values from the login-request. The values are connected to a person and are gained when an actual login to the system has been made.
store: <<STORE>> user_id: <<USER_ID>> user_token: <<USER_TOKEN>> api_key: <<API_KEY>> Accept: application/json Content-Type: application/json
Errors:
Code | Description |
---|---|
900001 | Credentials don't match |
900101 | Common error |
900429 | Too many requests |
900911 | Error when getting cost center |
900912 | Error when create a cost center |
900913 | Error when updating a cost center |
900914 | Error when deleting a cost center |
{ "errorCode" : 900101, "errorMessage" : "Something went wrong on the server", "errorField" : null, "errorData" : null }
Cost centers API:
Cost centers
Get cost center
GETUrl: /{cost_center}
Headers:
Accept: application/json or application/xml
Get a cost centers based on cost center id
Body:
Successfull response:
{ "since": 2384, "costCenters": [{ "name": "name", "externalId": "externalId", "active": true, "id": 2264, "shortName": "shortName" }] }
Get cost centers
GETUrl:
Headers:
Accept: application/json or application/xml
Get a list of cost centers for customer orders
Valid parameters:
Parameter | Description | Default value | Allowed values |
---|---|---|---|
since | 0 |
Body:
Successfull response:
{ "since": 6748, "costCenters": [{ "name": "name", "externalId": "externalId", "active": true, "id": 5331, "shortName": "shortName" }] }
Add cost centers
POSTUrl:
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Add a new cost center
Body:
{ "name": "name", "active": true, "shortName": "shortName" }
Successfull response:
{ "name": "name", "externalId": "externalId", "active": false, "id": 3497, "shortName": "shortName" }
Update cost centers
PUTUrl: /{cost_center}
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Update an existing cost center
Body:
{ "name": "name", "externalId": "externalId", "active": false, "id": 9812, "shortName": "shortName" }
Successfull response:
{ "name": "name", "externalId": "externalId", "active": false, "id": 9483, "shortName": "shortName" }
Delete cost center
DELETEUrl: /{cost_center}
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Delete an existing costcenter
Body:
Successfull response:
Classes:
CostCenter
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
id | long | R | |||||
externalId | String | R | |||||
shortName | String | Write only when POST | Post | R,W | |||
name | String | Post | R,W | ||||
active | boolean | R,W |
CostCentersResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
since | long | R | |||||
costCenters | List | R |