Stores API
General:
Basics:
Base-URL: https://capi.lagerkoll.com/v1/stores/
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 |
901702 | Error when adding store |
901703 | Error when updating store |
901704 | Error when deleting store |
{ "errorCode" : 900101, "errorMessage" : "Something went wrong on the server", "errorField" : null, "errorData" : null }
Stores API:
Stores
Get stores
GETUrl:
Headers:
Accept: application/json or application/xml
Get a list of accessible stores
Body:
Successfull response:
{ "orgName": "orgName", "stores": [{ "storeGroupId": 522, "isMaster": true, "name": "name", "articleSuffix": "articleSuffix", "currency": "currency", "language": "language", "storeId": 9875 }], "orgNumber": "orgNumber" }
Get retention info
GETUrl: /retention
Headers:
Accept: application/json or application/xml
Retention information is used to bundle useful information about the company account's status
Body:
Successfull response:
{ "deliveredCustomerOrderProducts": 4360, "groupId": 7056, "closedSupplierOrderProducts": 9260, "sentOrders": 9405, "storeId": 7598, "closedCustomerOrders": 7783, "getLastInventoryDueDate": 1732182038473, "stockValue": 6081.83010876816, "openCustomerOrders": 6198, "stockValueFIFO": 5000.486207180111, "openCustomerOrderProducts": 7459, "articlesCount": 8331, "sentSupplierOrderProducts": 5690, "closedOrders": 7916 }
Get calculated deactivation date
GETUrl: /calculatedDeactivationDate
Headers:
Accept: application/json or application/xml
Calculates what deactivation date would be for an active store
Add store
POSTUrl:
Headers:
Accept: application/json or application/xml
Add a new store to group
Body:
{ "zip": "zip", "invoiceZip": "invoiceZip", "country": "country", "invocieAddress2": "invocieAddress2", "address": "address", "invoiceCountry": "invoiceCountry", "address2": "address2", "city": "city", "companyName": "companyName", "contactPerson": "contactPerson", "invoiceAddress": "invoiceAddress", "invoiceEmail": "invoiceEmail", "suffix": "suffix", "invoiceCity": "invoiceCity", "includeVat": "false", "phone": "phone", "storeName": "storeName", "currency": "currency", "orgNumber": "orgNumber", "email": "email" }
Successfull response:
{ "storeGroupId": 7478, "isMaster": true, "name": "name", "articleSuffix": "articleSuffix", "currency": "currency", "language": "language", "storeId": 7202 }
Deactivate a store
PUTUrl: /deactivate
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Deactivating a store will set a deactivation date into the future. Once that deactivation date has been reached the store can no longer be accessed and is marked for deletion after a period of time
Body:
Successfull response:
Reactivate a store
PUTUrl: /reactivate
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Reactivating a store will remove the deactivate date and the store is no longer marked for deletion
Body:
Successfull response:
Clear a store
PUTUrl: /clear
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Clearing a store will delete all data connected to that store; articles, customers, orders, suppliers...
Body:
Successfull response:
Delete a store
DELETEUrl:
Headers:
Accept: application/json or application/xml
Delete a store, articles are moved to the store with id = move_to_store if it exists
Valid parameters:
Parameter | Description | Default value | Allowed values |
---|---|---|---|
move_to_store |
Body:
Successfull response:
Classes:
DateResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
date | Date | R |
RetentionResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
storeId | long | R | |||||
groupId | long | R | |||||
getLastInventoryDueDate | Date | R | |||||
articlesCount | int | R | |||||
sentOrders | int | R | |||||
openCustomerOrders | int | R | |||||
closedOrders | int | R | |||||
closedCustomerOrders | int | R | |||||
stockValue | Double | R | |||||
stockValueFIFO | Double | R | |||||
sentSupplierOrderProducts | int | R | |||||
openCustomerOrderProducts | int | R | |||||
closedSupplierOrderProducts | int | R | |||||
deliveredCustomerOrderProducts | int | R |
Store
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
storeId | long | R | |||||
storeGroupId | long | R | |||||
name | String | R | |||||
currency | String | R | |||||
language | String | R | |||||
isMaster | Boolean | R | |||||
articleSuffix | String | R |
StoreRequest
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
companyName | String | Name of company | Post | R,W | |||
orgNumber | String | Organisation number | Post | R,W | |||
storeName | String | Name of store | Post | R,W | |||
suffix | String | Store suffix. If external integration is active (Fortnox / Visma) all articles in this store will have a suffix added to each article in those systems to handle multiple stores. Suffix must be unique within the same group | Post | R,W | |||
String | Admin email | Post | R,W | ||||
phone | String | Phonenumber | Post | R,W | |||
currency | String | Sales currency | Post | R,W | |||
contactPerson | String | Contact person | Post | R,W | |||
address | String | Street address (Visiting / Deliveries) | Post | R,W | |||
address2 | String | Street address 2 | R,W | ||||
city | String | City | Post | R,W | |||
zip | String | Zip | Post | R,W | |||
country | String | Country | Post | R,W | |||
invoiceAddress | String | Invoice address | R,W | ||||
invocieAddress2 | String | Invoice address 2 | R,W | ||||
invoiceCity | String | Invoice city | R,W | ||||
invoiceZip | String | Invoice zip code | R,W | ||||
invoiceCountry | String | Invoice country | R,W | ||||
invoiceEmail | String | Invoice email | R,W | ||||
includeVat | Boolean | Include vat in sales prices | false | R,W |
StoresResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
orgName | String | R | |||||
orgNumber | String | R | |||||
stores | List | R |