Goto APIs

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.

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
901601 Error getting 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
Body:
Successfull response:

Get document metadata

GETUrl: /{document_name : .+}
Headers:
Accept: application/json or application/xml
Get document metadata
Body:
Successfull response:

{"documents": [{ "readPermissions": [{}], "filename": "filename", "ownerName": "ownerName", "created": 1679783893061, "description": "description", "filesize": 1389, "ownerId": 4853, "version": "version" }]}

Get document metadatas

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

{"documents": [{ "readPermissions": [{}], "filename": "filename", "ownerName": "ownerName", "created": 1679783893061, "description": "description", "filesize": 261, "ownerId": 5027, "version": "version" }]}

Upload document

POSTUrl:
Headers:
Accept: application/json or application/xml
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 permissions to read the file. If empty, the file becomes available for all users. If multiple permissions, send multiple fields with the same id

Body:
Successfull response:

{ "readPermissions": [{}], "filename": "filename", "ownerName": "ownerName", "created": 1679783893063, "description": "description", "filesize": 2022, "ownerId": 8505, "version": "version" }

Delete document

DELETEUrl: /{document_name}
Headers:
Accept: application/json or application/xml
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
Body:
Successfull response:

Get system document metadatas

GETUrl: /system
Headers:
Accept: application/json or application/xml
Get list of system document metadatas
Body:
Successfull response:

{"documents": [{ "readPermissions": [{}], "filename": "filename", "ownerName": "ownerName", "created": 1679783893064, "description": "description", "filesize": 1107, "ownerId": 1296, "version": "version" }]}

Classes:

Document

Field Type Description Default Mandatory Accepted values Example values Access
description String R,W
version String R,W
filename String 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 Permission a user must have to be able to access this document R

DocumentsResponse

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