Projects API
General:
Basics:
Base-URL: https://capi.lagerkoll.com/v1/projects/
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 |
906001 | Error when getting project |
906002 | Error when getting customer |
906003 | Error when getting user |
906004 | Error when getting article |
906005 | Error when getting invoice draft |
906011 | Error when creating a project |
906012 | Error when creating a project article |
906013 | Error when creating invoice draft from articles |
906014 | Error when creating invoice from invoice drafts |
906021 | Error when updating a project |
906022 | Error when updating a project article |
906023 | Error when updating an invoice draft |
906031 | To large amount for the artcile |
906032 | Project still has articles with amount in them |
{ "errorCode" : 900101, "errorMessage" : "Something went wrong on the server", "errorField" : null, "errorData" : null }
Projects API:
Projects
Get invoice drafts
GETUrl: /{project_id}/articles/invoice
Headers:
Accept: application/json or application/xml
Get a list of invoice drafts for a project
Valid parameters:
Parameter | Description | Default value | Allowed values |
---|---|---|---|
state | 0-invoice drafts that are not invoiced or in processed, 1-invoice drafts that are in process but not yet invoiced 2-invoice drafts which are invoiced and processed | 0 | 0, 1, 2 |
page | 0 | ||
limit | 50 | ||
sort_column | created | article_id, article_name, user, created | |
sort_order | desc | asc,desc |
Body:
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 8987.557968206318, "articleName": "articleName", "pricelistId": 8098, "endDate": 1679783598433, "rentalAmount": 3789.8792797285296, "created": 1679783598433, "dataType": "dataType", "articleId": "articleId", "isInvoiced": false, "rentalCurrency": "rentalCurrency", "dataId": 8446, "price": 3598.7751797371125, "isProcessed": false, "dataArticleId": 4805, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 3954, "startDate": 1679783598433, "createdById": 4470 }], "pages": 1973, "pageSize": 1583, "draftsCount": 6846, "page": 6345 }
Get project for id
GETUrl: /{project_id}
Headers:
Accept: application/json or application/xml
Get project based on id
Body:
Successfull response:
{ "createdByName": "createdByName", "created": 9572, "name": "name", "customerId": 8281, "description": "description", "state": "0", "projectId": 8987, "responsibleUserId": 989, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 8928.020221296163, "batchSnBestBefore": 8934, "accountName": "accountName", "articleId": "articleId", "priceListId": 258, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 6472, "checkoutDate": 1485, "isRental": true, "price": 4543.810255420304, "comment": "comment", "id": 3011, "projectId": 4349, "checkoutAmount": 4891.520767304518, "checkinConsumeDate": 1679783598433, "checkinAmount": 1180.7680621053973, "consumedAmount": 815.843189081874 }], "customerName": "customerName", "createdById": 9349, "responsibleUserName": "responsibleUserName" }
Get projects
GETUrl:
Headers:
Accept: application/json or application/xml
Get a list of projects
Valid parameters:
Parameter | Description | Default value | Allowed values |
---|---|---|---|
state | -1 | 0,1 | |
from | 0 | ||
to | 0 | ||
page | 0 | ||
limit | 50 | ||
query | |||
sort_column | start_date | start_date,end_date | |
order | desc | asc,desc |
Body:
Successfull response:
{ "pages": 5038, "projects": [{ "createdByName": "createdByName", "created": 8289, "name": "name", "customerId": 9930, "description": "description", "state": "0", "projectId": 730, "responsibleUserId": 8324, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 8440.959056360372, "batchSnBestBefore": 9404, "accountName": "accountName", "articleId": "articleId", "priceListId": 1284, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 8235, "checkoutDate": 3864, "isRental": false, "price": 4584.290403944945, "comment": "comment", "id": 3379, "projectId": 3676, "checkoutAmount": 2096.176361395654, "checkinConsumeDate": 1679783598434, "checkinAmount": 2534.112872141816, "consumedAmount": 7234.04940692655 }], "customerName": "customerName", "createdById": 1071, "responsibleUserName": "responsibleUserName" }], "pageSize": 6311, "page": 4167, "projectsCount": 1162 }
Get project articles
GETUrl: /{project_id}/articles
Headers:
Accept: application/json or application/xml
Get a list of project articles
Valid parameters:
Parameter | Description | Default value | Allowed values |
---|---|---|---|
state | 0-all articles, 1-only checked out articles with available value, 2-checked out and rental articles with available value | 0 | 0,1,2 |
page | 0 | ||
limit | 50 | ||
sort_column | checkout_date | article_id, article_name, user, checkout_date | |
sort_order | desc | asc,desc |
Body:
Successfull response:
{ "pages": 3058, "pageSize": 4517, "page": 8716, "projectsCount": 3002, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 2348.110726033399, "batchSnBestBefore": 4464, "accountName": "accountName", "articleId": "articleId", "priceListId": 8554, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 8097, "checkoutDate": 3200, "isRental": false, "price": 8935.247862398668, "comment": "comment", "id": 1451, "projectId": 7462, "checkoutAmount": 447.38205508722984, "checkinConsumeDate": 1679783598434, "checkinAmount": 1752.2180701235036, "consumedAmount": 2888.049860497298 }] }
Get cost for project
GETUrl: /{project_id}/cost
Headers:
Accept: application/json or application/xml
Get total cost for a project
Body:
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 6401.365061789096, "articleName": "articleName", "pricelistId": 4154, "endDate": 1679783598435, "rentalAmount": 3746.5946567857955, "created": 1679783598435, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 4519, "price": 368.0281449175848, "isProcessed": false, "dataArticleId": 5786, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 6192, "startDate": 1679783598435, "createdById": 6750 }], "pages": 1958, "pageSize": 5791, "draftsCount": 6088, "page": 1783 }
Add project
POSTUrl:
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Add a new project
Body:
{ "createdByName": "createdByName", "created": 3383, "name": "name", "customerId": 2183, "description": "description", "state": "0", "responsibleUserId": 5407, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 6346.141010238052, "batchSnBestBefore": 2751, "accountName": "accountName", "articleId": "articleId", "priceListId": 9615, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 5423, "checkoutDate": 9838, "isRental": false, "price": 2243.260888606805, "comment": "comment", "id": 5289, "projectId": 1839, "checkoutAmount": 3258.7512021582666, "checkinConsumeDate": 1679783598435, "checkinAmount": 5814.922007957951, "consumedAmount": 184.0997807681355 }], "customerName": "customerName", "createdById": 9361, "responsibleUserName": "responsibleUserName" }
Successfull response:
{ "createdByName": "createdByName", "created": 8712, "name": "name", "customerId": 9842, "description": "description", "state": "0", "projectId": 8560, "responsibleUserId": 1344, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 4970.276603510641, "batchSnBestBefore": 6062, "accountName": "accountName", "articleId": "articleId", "priceListId": 2928, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 3455, "checkoutDate": 3210, "isRental": false, "price": 5118.823902809837, "comment": "comment", "id": 2628, "projectId": 8906, "checkoutAmount": 356.48364742678405, "checkinConsumeDate": 1679783598435, "checkinAmount": 6370.299096751169, "consumedAmount": 2038.439968383492 }], "customerName": "customerName", "createdById": 5873, "responsibleUserName": "responsibleUserName" }
Add project article
POSTUrl: /{id}/article
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Add a new article to a project
Body:
{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 8797.842459485768, "batchSnBestBefore": 7267, "accountName": "accountName", "articleId": "articleId", "priceListId": 1135, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 3265, "checkoutDate": 5695, "isRental": true, "price": 690.7474504033429, "comment": "comment", "id": 8208, "projectId": 7216, "checkoutAmount": 2585.4897134439125, "checkinConsumeDate": 1679783598436, "checkinAmount": 7558.021878214785, "consumedAmount": 4375.291678124065 }
Successfull response:
{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 7291.751162475817, "batchSnBestBefore": 7563, "accountName": "accountName", "articleId": "articleId", "priceListId": 4809, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 5063, "checkoutDate": 4640, "isRental": false, "price": 5787.406405874162, "comment": "comment", "id": 6104, "projectId": 2393, "checkoutAmount": 5107.688926050826, "checkinConsumeDate": 1679783598436, "checkinAmount": 2068.2413410081567, "consumedAmount": 387.9303131032308 }
Update project
PUTUrl: /{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 project
Body:
{ "createdByName": "createdByName", "created": 155, "name": "name", "customerId": 9863, "description": "description", "state": "0", "projectId": 4102, "responsibleUserId": 1097, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 5254.723341254496, "batchSnBestBefore": 85, "accountName": "accountName", "articleId": "articleId", "priceListId": 525, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 2257, "checkoutDate": 9933, "isRental": false, "price": 155.63649160092007, "comment": "comment", "id": 4524, "projectId": 5309, "checkoutAmount": 3200.212456121515, "checkinConsumeDate": 1679783598436, "checkinAmount": 1948.9485183469158, "consumedAmount": 8632.764738898506 }], "customerName": "customerName", "createdById": 8280, "responsibleUserName": "responsibleUserName" }
Successfull response:
{ "createdByName": "createdByName", "created": 8468, "name": "name", "customerId": 5801, "description": "description", "state": "0", "projectId": 6766, "responsibleUserId": 2205, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 5716.851107404054, "batchSnBestBefore": 1816, "accountName": "accountName", "articleId": "articleId", "priceListId": 7016, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 4413, "checkoutDate": 508, "isRental": true, "price": 6696.535218247965, "comment": "comment", "id": 3737, "projectId": 8487, "checkoutAmount": 8837.93759759455, "checkinConsumeDate": 1679783598436, "checkinAmount": 1482.913645449221, "consumedAmount": 1397.1957556267066 }], "customerName": "customerName", "createdById": 338, "responsibleUserName": "responsibleUserName" }
Update project article
PUTUrl: /{id}/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 an existing project article
Body:
{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 7624.566530196117, "batchSnBestBefore": 4597, "accountName": "accountName", "articleId": "articleId", "priceListId": 1420, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 5370, "checkoutDate": 8715, "isRental": true, "price": 3985.899688565344, "comment": "comment", "id": 8605, "projectId": 4111, "checkoutAmount": 1872.272900255285, "checkinConsumeDate": 1679783598437, "checkinAmount": 1719.0389340916136, "consumedAmount": 1611.688674651095 }
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 9718.520232879637, "articleName": "articleName", "pricelistId": 6049, "endDate": 1679783598437, "rentalAmount": 7654.275313469317, "created": 1679783598437, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 7755, "price": 2580.5112270460327, "isProcessed": false, "dataArticleId": 5587, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 1621, "startDate": 1679783598437, "createdById": 6984 }], "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 3864.6116121635764, "batchSnBestBefore": 281, "accountName": "accountName", "articleId": "articleId", "priceListId": 7243, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 8746, "checkoutDate": 5486, "isRental": false, "price": 1944.925018028507, "comment": "comment", "id": 8416, "projectId": 9700, "checkoutAmount": 6258.158761288196, "checkinConsumeDate": 1679783598437, "checkinAmount": 8768.063127198213, "consumedAmount": 8329.970228989496 }] }
Create invoice drafts
PUTUrl: /{id}/invoice/draft
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Create invoice drafts for articles in a project
Body:
{ "projectId": 2644, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 2177.4101502623944, "batchSnBestBefore": 2180, "accountName": "accountName", "articleId": "articleId", "priceListId": 7244, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 8850, "checkoutDate": 4095, "isRental": false, "price": 3589.3192629917758, "comment": "comment", "id": 4289, "projectId": 9176, "checkoutAmount": 3482.6957603222463, "checkinConsumeDate": 1679783598437, "checkinAmount": 3655.853582149421, "consumedAmount": 6409.748868814925 }] }
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 5034.838954286331, "articleName": "articleName", "pricelistId": 674, "endDate": 1679783598437, "rentalAmount": 8469.159910375076, "created": 1679783598437, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 5219, "price": 9180.636948522038, "isProcessed": true, "dataArticleId": 1119, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 1488, "startDate": 1679783598437, "createdById": 2052 }], "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 8032.315531249541, "batchSnBestBefore": 2637, "accountName": "accountName", "articleId": "articleId", "priceListId": 9936, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 7245, "checkoutDate": 3364, "isRental": false, "price": 1136.951998495832, "comment": "comment", "id": 3140, "projectId": 17, "checkoutAmount": 6202.601027698183, "checkinConsumeDate": 1679783598437, "checkinAmount": 5415.150636182753, "consumedAmount": 8131.072439116513 }] }
Send invoice drafts to external integrations
PUTUrl: /{id}/invoice
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Send existing invoice drafts to external integrations and sets the draft to invoiced
Body:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 576.4640640027375, "articleName": "articleName", "pricelistId": 1024, "endDate": 1679783598438, "rentalAmount": 8647.202848006482, "created": 1679783598438, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 3396, "price": 2050.2090656659234, "isProcessed": true, "dataArticleId": 9306, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 1300, "startDate": 1679783598438, "createdById": 2940 }], "customerId": 8480, "type": "type", "projectId": 9830 }
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 2449.4974524900426, "articleName": "articleName", "pricelistId": 5404, "endDate": 1679783598438, "rentalAmount": 1941.0224721620373, "created": 1679783598438, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 6447, "price": 377.14096720703697, "isProcessed": true, "dataArticleId": 6813, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 9158, "startDate": 1679783598438, "createdById": 9477 }], "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 4653.719154058562, "batchSnBestBefore": 8184, "accountName": "accountName", "articleId": "articleId", "priceListId": 8571, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 6413, "checkoutDate": 6392, "isRental": false, "price": 9685.400815465819, "comment": "comment", "id": 1005, "projectId": 1858, "checkoutAmount": 914.1870850369716, "checkinConsumeDate": 1679783598438, "checkinAmount": 7911.823173821904, "consumedAmount": 2082.5529953476375 }] }
Close project
PUTUrl: /{id}/close
Headers:
Accept: application/json or application/xml
Content-type: application/json or application/xml
Content-type: application/json or application/xml
Close an existing project
Body:
{"closeArticles": {}}
Successfull response:
{ "createdByName": "createdByName", "created": 6800, "name": "name", "customerId": 8719, "description": "description", "state": "0", "projectId": 8585, "responsibleUserId": 6796, "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 7210.319895523888, "batchSnBestBefore": 5818, "accountName": "accountName", "articleId": "articleId", "priceListId": 7155, "batchId": "batchId", "rentalCurrency": "rentalCurrency", "accountId": 6193, "checkoutDate": 501, "isRental": true, "price": 3164.149617810461, "comment": "comment", "id": 328, "projectId": 2759, "checkoutAmount": 9462.970913198915, "checkinConsumeDate": 1679783598438, "checkinAmount": 8192.439697490452, "consumedAmount": 3119.0838629016084 }], "customerName": "customerName", "createdById": 338, "responsibleUserName": "responsibleUserName" }
Classes:
CloseProjectRequest
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
closeArticles | HashMap | R |
InvoiceDraft
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
id | long | R | |||||
dataType | String | R | |||||
dataId | Long | R | |||||
dataArticleId | Long | R | |||||
articleId | String | R | |||||
articleName | String | R | |||||
amount | Double | R | |||||
price | Double | R | |||||
pricelistId | long | R | |||||
currency | String | R | |||||
rentalCurrency | String | R | |||||
startDate | Date | R | |||||
endDate | Date | R | |||||
rentalAmount | Double | R | |||||
comment | String | R | |||||
isInvoiced | boolean | Indicates if row has been marked as invoiced | R | ||||
isProcessed | boolean | Indicates if row has been completely processed as invoiced | R | ||||
invoiceId | String | If row has been invoiced, this is id of the created invoice | R | ||||
createdById | Long | R | |||||
createdByName | String | R | |||||
created | Date | R |
InvoiceDraftProjectArticlesRequest
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
projectId | long | R | |||||
articles | List | R |
InvoiceProjectArticlesRequest
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
projectId | long | R | |||||
customerId | Long | R | |||||
type | String | invoice, cash, card, ag | R | ||||
invoiceDrafts | List | R |
InvoiceProjectArticlesResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
articles | List | R | |||||
invoiceDrafts | List | R |
Project
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
projectId | long | R | |||||
name | String | R,W | |||||
customerId | Long | R,W | |||||
customerName | String | R,W | |||||
description | String | R,W | |||||
state | Integer | Write only with POST | 0 | NEW = 0, DEVELOPING = 1, FINISHED = 2, CANCELLED = 3 |
R,W | ||
responsibleUserId | Long | R,W | |||||
responsibleUserName | String | R,W | |||||
createdById | Long | R,W | |||||
createdByName | String | R,W | |||||
created | long | R,W | |||||
articles | List | R,W |
ProjectArticle
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
id | long | R,W | |||||
projectId | long | R,W | |||||
articleId | String | R,W | |||||
articleName | String | R,W | |||||
batchId | String | R,W | |||||
snId | String | R,W | |||||
batchSnBestBefore | Long | R,W | |||||
checkoutAmount | Double | R,W | |||||
checkinAmount | Double | R,W | |||||
consumedAmount | Double | R,W | |||||
invoicedAmount | Double | R,W | |||||
priceListId | long | R,W | |||||
isRental | boolean | R,W | |||||
price | double | R,W | |||||
rentalCurrency | String | R,W | |||||
comment | String | R,W | |||||
accountId | long | R,W | |||||
accountName | String | R,W | |||||
checkoutDate | Long | R,W | |||||
checkinConsumeDate | Date | R,W |
ProjectArticlesResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
page | int | R | |||||
pages | int | R | |||||
pageSize | int | R | |||||
projectsCount | int | R | |||||
articles | List | R |
ProjectInvoiceDraftsResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
page | int | R | |||||
pages | int | R | |||||
pageSize | int | R | |||||
draftsCount | int | R | |||||
invoiceDrafts | List | R |
ProjectsResponse
Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
---|---|---|---|---|---|---|---|
page | int | R | |||||
pages | int | R | |||||
pageSize | int | R | |||||
projectsCount | int | R | |||||
projects | List | R |