Goto APIs

Roles API

General:

Basics:

Base-URL: https://capi.lagerkoll.com/v1/roles/
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.

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.
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
908001 Error getting role
908002 Error creating role
908003 Error updating role
{
  "errorCode" : 900101,
  "errorMessage" : "Something went wrong on the server",
  "errorField" : null,
  "errorData" : null
}

Roles API:

Role

Get roles

GETUrl:
Headers:
Accept: application/json or application/xml
Get list of roles
Body:
Successfull response:

{"roles": [{ "storeGroupId": 3641, "paths": [{ "path": "path", "action": "action" }], "name": "name", "id": 3031, "fields": {}, "portal": "portal", "users": 7851 }]}

Get role

GETUrl: /{role_id}
Headers:
Accept: application/json or application/xml
Get role by id
Body:
Successfull response:

{"roles": [{ "storeGroupId": 6271, "paths": [{ "path": "path", "action": "action" }], "name": "name", "id": 1171, "fields": {}, "portal": "portal", "users": 3722 }]}

Add role

POSTUrl:
Headers:
Accept: application/json or application/xml
Add new role
Body:

{ "paths": [{ "path": "path", "action": "action" }], "name": "name", "fields": {}, "portal": "portal" }
Successfull response:

{"roles": [{ "storeGroupId": 882, "paths": [{ "path": "path", "action": "action" }], "name": "name", "id": 592, "fields": {}, "portal": "portal", "users": 4466 }]}

Update role

PUTUrl: /{role_id}
Headers:
Accept: application/json or application/xml
Update existing role
Body:

{ "storeGroupId": 7090, "paths": [{ "path": "path", "action": "action" }], "name": "name", "id": 6125, "fields": {}, "portal": "portal", "users": 273 }
Successfull response:

{"roles": [{ "storeGroupId": 5111, "paths": [{ "path": "path", "action": "action" }], "name": "name", "id": 7916, "fields": {}, "portal": "portal", "users": 2776 }]}

Delete role

DELETEUrl: /{role_id}
Headers:
Accept: application/json or application/xml
Delete existing role
Body:
Successfull response:

Classes:

Path

Field Type Description Default Mandatory Accepted values Example values Access
path String Path of allowed api request R,W
action String Method/action of the request get, post, put, delete, * R,W

Role

Field Type Description Default Mandatory Accepted values Example values Access
id Long R
storeGroupId Long R
name String R,W
paths List List of paths role has access to R,W
fields HashMap List of objects and fields that is filtered out when sending data to api and request data from api R,W
portal String What part of Lagerkoll is the role used ADMIN, SHOP R,W
users int Number of users connected to role R

RolesResponse

Field Type Description Default Mandatory Accepted values Example values Access
roles List R