Documents API
General:
Basics:
Base-URL: https://capi.lagerkoll.com/v1/documents/
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 |
| 902301 | Error getting document |
| 902302 | Error copying document |
{
"errorCode" : 900101,
"errorMessage" : "Something went wrong on the server",
"errorField" : null,
"errorData" : null
}
Documents API:
Document
Get document binary
GETUrl: /{document_name : .+}/binary
Headers:
Accept: application/octet-stream or application/json
Get document binary
Get document metadata
GETUrl: /{document_name : .+}
Headers:
Accept: application/json or application/xml
Get document metadata
Body:
Successfull response:
{ "documentsCount": 8801, "pages": 8223, "documents": [{ "readPermissions": [{ "loginServices": [{}], "storeGroupId": 6374, "paths": {}, "name": "name", "id": 6817, "nativeFeatures": [{}], "fields": {}, "portal": "portal", "users": 2568 }], "filename": "filename", "ownerName": "ownerName", "created": 1765735741410, "description": "description", "filesize": 7876, "type": "type", "ownerId": 427, "version": "version" }], "pageSize": 5664, "page": 1463 }
Get document metadatas
GETUrl:
Headers:
Accept: application/json or application/xml
Get list of document metadatas
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| query | |||
| type | |||
| page | 0 | ||
| limit | 25 | ||
| order | desc | asc,desc | |
| sort_column | created | type,filename,created |
Body:
Successfull response:
{ "documentsCount": 4552, "pages": 713, "documents": [{ "readPermissions": [{ "loginServices": [{}], "storeGroupId": 3762, "paths": {}, "name": "name", "id": 1505, "nativeFeatures": [{}], "fields": {}, "portal": "portal", "users": 164 }], "filename": "filename", "ownerName": "ownerName", "created": 1765735741411, "description": "description", "filesize": 509, "type": "type", "ownerId": 431, "version": "version" }], "pageSize": 8979, "page": 1435 }
Upload document
POSTUrl:
Headers:
Accept: application/json or application/xml
Content-type: multipart/form-data
Content-type: multipart/form-data
Upload document. Max size is 4Mb.
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| file | Inputstream to be uploaded | ||
| file | |||
| description | Description of file | ||
| version | Version of the file | ||
| filename | The filename to be stored with the file | ||
| read_permissions | List of role ids that have permission to read the file. If empty, the file becomes available for all users. If multiple permissions, send multiple fields with the same id | ||
| type | Type of file |
Body:
Successfull response:
{ "readPermissions": [{ "loginServices": [{}], "storeGroupId": 8765, "paths": {}, "name": "name", "id": 2889, "nativeFeatures": [{}], "fields": {}, "portal": "portal", "users": 9359 }], "filename": "filename", "ownerName": "ownerName", "created": 1765735741411, "description": "description", "filesize": 7580, "type": "type", "ownerId": 4846, "version": "version" }
Copy document
POSTUrl: /{document_name : .+}/copy
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Copy a document to a new document with new filename and description
Body:
{ "filename": "filename", "description": "description", "type": "type", "version": "version" }
Successfull response:
{ "readPermissions": [{ "loginServices": [{}], "storeGroupId": 9714, "paths": {}, "name": "name", "id": 9149, "nativeFeatures": [{}], "fields": {}, "portal": "portal", "users": 472 }], "filename": "filename", "ownerName": "ownerName", "created": 1765735741411, "description": "description", "filesize": 8045, "type": "type", "ownerId": 5390, "version": "version" }
Delete document
DELETEUrl: /{document_name}
Headers:
Accept: application/json or application/xml
Content-type: application/json
Content-type: application/json
Delete document
Body:
Successfull response:
System Document
Get system document binary
GETUrl: /system/{document_name : .+}/binary
Headers:
Accept: application/octet-stream or application/json
Get system document binary
Get system document metadatas
GETUrl: /system
Headers:
Accept: application/json or application/xml
Get list of system document metadatas
Body:
Successfull response:
{ "documentsCount": 2603, "pages": 8447, "documents": [{ "readPermissions": [{ "loginServices": [{}], "storeGroupId": 3617, "paths": {}, "name": "name", "id": 6505, "nativeFeatures": [{}], "fields": {}, "portal": "portal", "users": 369 }], "filename": "filename", "ownerName": "ownerName", "created": 1765735741412, "description": "description", "filesize": 6084, "type": "type", "ownerId": 4921, "version": "version" }], "pageSize": 7760, "page": 9600 }
Classes:
DocumentDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| description | String | R,W | |||||
| version | String | Can only be set when creating | R,W | ||||
| filename | String | R,W | |||||
| type | String | Can only be set when creating | R,W | ||||
| filesize | long | Filesize in bytes | R | ||||
| created | Date | R | |||||
| ownerId | Long | Id of the user who created the document | R | ||||
| ownerName | String | Name of the user who created the document | R | ||||
| readPermissions | List | Roles that have read access to this document | R |
DocumentsResponseDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| page | int | R | |||||
| pages | int | R | |||||
| pageSize | int | R | |||||
| documentsCount | int | R | |||||
| documents | List | R |
RoleDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| id | Long | R | |||||
| storeGroupId | Long | R | |||||
| name | String | R,W | |||||
| paths | ArrayList | 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 | ||||
| loginServices | List | List of login services role has access to | R,W | ||||
| nativeFeatures | List | List of native features in mobile application role has access to | R,W |