Prices API
General:
Basics:
Base-URL: https://capi.lagerkoll.com/v1/prices/
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 |
| 900301 | Error when getting a pricelist |
| 900302 | Error when creating a pricelist |
| 900303 | Error when updating a pricelist |
| 900304 | Error when deleting a pricelist |
| 900305 | Error when getting a single price |
| 900311 | Error when getting prices |
| 900312 | Error when creating a price |
| 900313 | Error when updating a price |
| 900314 | Error when deleting a price |
{
"errorCode" : 900101,
"errorMessage" : "Something went wrong on the server",
"errorField" : null,
"errorData" : null
}
Prices API:
Pricelists
Get pricelists
GETUrl: /lists
Headers:
Accept: application/json or application/xml
Get a list of pricelists
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| query | |||
| page | 0 | ||
| limit | 25 | ||
| order | asc | ||
| sort_column | code | id, code, name, currency |
Body:
Successfull response:
{ "pricelists": [{ "code": "code", "rate": 7773.23324767411, "name": "name", "description": "description", "currency": "currency", "id": 9889, "preSelected": false }], "pages": 625, "pricelistsCount": 2723, "pageSize": 5947, "page": 3613 }
Get pricelist
GETUrl: /lists/{id}
Headers:
Accept: application/json or application/xml
Get a single pricelist based in pricelist id
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| default_if_missing | true |
Body:
Successfull response:
{ "pricelists": [{ "code": "code", "rate": 5008.548103938803, "name": "name", "description": "description", "currency": "currency", "id": 2535, "preSelected": true }], "pages": 3046, "pricelistsCount": 5000, "pageSize": 3685, "page": 6686 }
Add pricelist
POSTUrl: /lists
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Add a new pricelist
Body:
{ "code": "code", "name": "name", "description": "description", "currency": "currency", "preSelected": false }
Successfull response:
{ "code": "code", "rate": 2291.5235301224147, "name": "name", "description": "description", "currency": "currency", "id": 6664, "preSelected": false }
Update pricelist
PUTUrl: /lists/{id}
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Update an existing pricelist
Body:
{ "code": "code", "exchangeRate": 4753.072436005275, "name": "name", "description": "description", "currency": "currency", "id": 6648, "preSelected": false }
Successfull response:
{ "code": "code", "rate": 5722.779114855816, "name": "name", "description": "description", "currency": "currency", "id": 7724, "preSelected": false }
Delete pricelist
DELETEUrl: /lists/{id}
Headers:
Accept: application/json or application/xml
Delete an existing pricelist
Body:
Successfull response:
Prices
Calculate price
GETUrl: /lists/{list_id}/article/{article_id : .+}/amount/{amount}/price
Headers:
Accept: application/json or application/xml
Calculate price for a specific pricelist, article and amount
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| price | |||
| store | If checking prices for a customer order where article is from another store, pass that store | ||
| get_default_sales_price | true |
Get prices
GETUrl: /lists/{id}/prices
Headers:
Accept: application/json or application/xml
Get a list of prices for a specific pricelist
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| since | 0 | ||
| page | 0 | ||
| limit | 100 |
Body:
Successfull response:
{ "pages": 4343, "pageSize": 3004, "pricesCount": 7011, "page": 4207, "prices": [{ "listId": 7760, "price": "0", "articleId": "articleId", "fromQuantity": "0", "listExternalId": "listExternalId" }], "since": 566 }
Get prices for list and article
GETUrl: /lists/{id}/article/{article_id}/prices
Headers:
Accept: application/json or application/xml
Get a list of prices for a specific pricelist and article
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| since | 0 | ||
| page | 0 | ||
| limit | 100 |
Body:
Successfull response:
{ "pages": 657, "pageSize": 6578, "pricesCount": 6850, "page": 3482, "prices": [{ "listId": 7292, "price": "0", "articleId": "articleId", "fromQuantity": "0", "listExternalId": "listExternalId" }], "since": 2165 }
Get prices for article
GETUrl: /article/{article_id}/prices
Headers:
Accept: application/json or application/xml
Get a list of prices for a specific article
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| since | 0 | ||
| page | 0 | ||
| limit | 100 |
Body:
Successfull response:
{ "pages": 5819, "pageSize": 6788, "pricesCount": 8457, "page": 4326, "prices": [{ "listId": 7104, "price": "0", "articleId": "articleId", "fromQuantity": "0", "listExternalId": "listExternalId" }], "since": 6388 }
Add price
POSTUrl: /lists/{id}/prices
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Add a new price for a pricelist and article
Update prices
PUTUrl: /list
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Update a list of prices. Input is a list of ArticlePrices
Update price for article in list
PUTUrl: /lists/{id}/article/{article_id}/prices/{from}
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Update a price for a specific pricelist and article
Update prices for article
PUTUrl: /article/{article_id}
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Update a list of prices for a specific article. Input is a list of Prices
Body:
{}
Successfull response:
{ "listId": 4822, "price": "0", "articleId": "articleId", "fromQuantity": "0", "listExternalId": "listExternalId" }
Delete price
DELETEUrl: /lists/{id}/article/{article_id}/prices/{from}
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Delete a price on an article in a pricelist
Body:
Successfull response:
Classes:
CalculatePriceResponseDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| price | Double | R |
PriceDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| listId | Long | Write only with POST | Post | R,W | |||
| listExternalId | String | External id of pricelist | R | ||||
| articleId | String | Write only with POST | Post | R,W | |||
| fromQuantity | double | Write only with POST | 0 | R,W | |||
| price | Double | To remove a price, send null to server | 0 | R,W |
PricelistDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| id | long | R | |||||
| code | String | Write only with POST | Post | R,W | |||
| name | String | Write only with POST | Post | R,W | |||
| description | String | Post | R,W | ||||
| currency | String | R,W | |||||
| rate | double | R | |||||
| preSelected | boolean | R,W |
PricelistRequestDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| id | long | R | |||||
| code | String | Write only with POST | Post | R,W | |||
| name | String | Write only with POST | Post | R,W | |||
| description | String | Post | R,W | ||||
| currency | String | R,W | |||||
| preSelected | Boolean | Set this pricelist as the default and preselected pricelist. Only one pricelist can be set as default, so the previous one will have its flag reset | R,W | ||||
| exchangeRate | Double | R |
PricelistsResponseDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| page | int | R | |||||
| pages | int | R | |||||
| pageSize | int | R | |||||
| pricelistsCount | int | R | |||||
| pricelists | List | R |
PricesResponseDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| page | int | R | |||||
| pages | int | R | |||||
| pageSize | int | R | |||||
| pricesCount | int | R | |||||
| since | long | R | |||||
| prices | List | R |