Invoices API
Invoices API provides methods for handling invoices and invoice drafts
General:
Basics:
Base-URL: https://capi.lagerkoll.com/v1/invoices/
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 |
| 902501 | Error when getting invoice draft |
| 902502 | Error when adding invoice draft |
| 902503 | Error when updating invoice draft |
| 902504 | Error when deleting invoice draft |
| 902505 | Error when invoicing draft |
{
"errorCode" : 900101,
"errorMessage" : "Something went wrong on the server",
"errorField" : null,
"errorData" : null
}
Invoices API:
Invoice drafts
Get invoice drafts
GETUrl: /drafts
Headers:
Accept: application/json or application/xml
Get a list of invoice drafts
Valid parameters:
| Parameter | Description | Default value | Allowed values |
|---|---|---|---|
| query | |||
| type | ALL | ALL, PROJECT, CUSTOMER_ORDER | |
| return_invoiced_rows | true | ||
| page | 0 | ||
| limit | 100 | ||
| sort_column | created | type, article_id, article_name, user, created | |
| sort_order | desc | asc,desc |
Body:
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 2962.6763006532874, "articleName": "articleName", "pricelistId": 3807, "endDate": 1772868893065, "rentalAmount": 9225.232368643581, "created": 1772868893065, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 8215, "price": 9133.168735731657, "isProcessed": true, "dataArticleId": 661, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 252, "startDate": 1772868893065, "createdById": 1968 }], "ordersCount": 7461, "pages": 4344, "pageSize": 6908, "page": 1825 }
Create invoice draft
POSTUrl: /drafts/customer_order/{order_id}
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 customer order
Body:
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 8440.061407661617, "articleName": "articleName", "pricelistId": 1733, "endDate": 1772868893066, "rentalAmount": 8082.691746187253, "created": 1772868893066, "dataType": "dataType", "articleId": "articleId", "isInvoiced": true, "rentalCurrency": "rentalCurrency", "dataId": 1863, "price": 6372.877435934541, "isProcessed": true, "dataArticleId": 6630, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 4721, "startDate": 1772868893066, "createdById": 101 }], "ordersCount": 254, "pages": 820, "pageSize": 5208, "page": 3953 }
Invoice drafts
PUTUrl: /drafts/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:
{ "type": "type", "invoiceDraftIds": [{}] }
Successfull response:
{ "invoiceDrafts": [{ "createdByName": "createdByName", "amount": 5990.911051028726, "articleName": "articleName", "pricelistId": 2306, "endDate": 1772868893066, "rentalAmount": 5118.722058730377, "created": 1772868893066, "dataType": "dataType", "articleId": "articleId", "isInvoiced": false, "rentalCurrency": "rentalCurrency", "dataId": 5137, "price": 6801.675320400219, "isProcessed": true, "dataArticleId": 9355, "currency": "currency", "comment": "comment", "invoiceId": "invoiceId", "id": 218, "startDate": 1772868893066, "createdById": 4552 }], "articles": [{ "articleName": "articleName", "snId": "snId", "invoicedAmount": 3636.2617146248012, "batchSnBestBefore": 4800, "accountName": "accountName", "articleId": "articleId", "priceListId": 137, "purchasePrice": 2614.2713156598475, "batchId": "batchId", "rental": false, "rentalCurrency": "rentalCurrency", "accountId": 4641, "checkoutDate": 5345, "price": 2153.6074572770526, "comment": "comment", "id": 1004, "projectId": 7571, "checkoutAmount": 8408.859800343775, "events": [{ "date": 1772868893066, "amount": 4726.47531302346, "type": "type" }], "checkinConsumeDate": 1772868893066, "checkinAmount": 1250.488795337692, "consumedAmount": 6106.284970745051 }] }
Classes:
InvoiceDraftDto
| 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 |
InvoiceDraftIdsRequestDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| invoiceDraftIds | List | R,W | |||||
| type | String | invoice, cash, card, ag | R |
InvoiceDraftsResponseDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| page | int | R | |||||
| pages | int | R | |||||
| pageSize | int | R | |||||
| ordersCount | int | R | |||||
| invoiceDrafts | List | R |
InvoiceProjectArticlesResponseDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| articles | List | R | |||||
| invoiceDrafts | List | R |
ProjectArticleDto
| 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 | |||||
| rental | boolean | R,W | |||||
| price | double | R,W | |||||
| rentalCurrency | String | R,W | |||||
| comment | String | R,W | |||||
| purchasePrice | Double | R,W | |||||
| events | List | R,W | |||||
| accountId | long | R,W | |||||
| accountName | String | R,W | |||||
| checkoutDate | Long | R,W | |||||
| checkinConsumeDate | Date | R,W |
ProjectArticleEventDto
| Field | Type | Description | Default | Mandatory | Accepted values | Example values | Access |
|---|---|---|---|---|---|---|---|
| type | String | R,W | |||||
| amount | double | R,W | |||||
| date | Date | R,W |