Book an accounting document
const url = 'https://api.sancho-wms.pl/v1/accountingDocuments.post';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"integrationId":1,"id":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sancho-wms.pl/v1/accountingDocuments.post \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "integrationId": 1, "id": 1 }'Books the document by its proposed journal entry into that entry’s journal and answers result, the document as accountingDocuments.get reads it after the booking, with warnings (empty for now). An ERP that books into a draft journal answers the document with status: draft and journalEntry.status: draft until the accountant approves the entry in the ERP; a document whose entry is approved reads status: posted with journalEntry.status: posted. A document already booked to a journal entry, by an earlier call, by the accountant or by the ERP’s automatic booking, answers the document and writes nothing, and nothing in the answer says which. A document without a proposed journal entry is 422 noProposedJournalEntry, a booking date outside every fiscal year 422 noFiscalYear, a closed fiscal year 422 periodLocked, and a booking the ERP declined 422 postingFailed. Needs double-entry books and the ERP’s general-ledger module: 422 notDoubleEntry or ledgerNotLicensed otherwise.
Authorizations
Abschnitt betitelt „Authorizations“Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“Responses
Abschnitt betitelt „Responses“Successful response
object
object
object
object
object
object
object
object
object
object
object
object
Example
{ "result": { "kind": "purchase", "documentType": "invoice", "origin": "invoice", "status": "draft", "eInvoice": { "system": "ksef" }, "journalEntry": { "status": "draft" }, "taxReporting": { "country": "PL", "ksefMarker": "OFF", "gtu": [ "GTU_01" ], "procedures": [ "WSTO_EE" ], "documentMarker": "FP" }, "integrationType": "comarch-optima", "transactionKind": "domestic", "lines": [ { "taxRate": { "category": "standardRated" }, "deductible": "full", "lineKind": "goods", "rateStatus": "exempt" } ], "cashFlowItems": [ { "direction": "incoming", "settlementStatus": "notApplicable" } ] }, "warnings": [ { "stage": "placements" } ]}Bad request
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "BAD_REQUEST", "message": "Bad request", "issues": []}Unauthorized
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "UNAUTHORIZED", "message": "Unauthorized", "issues": []}Payment required
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "PAYMENT_REQUIRED", "message": "Payment required", "issues": []}Forbidden
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "FORBIDDEN", "message": "Forbidden", "issues": []}Not found
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "NOT_FOUND", "message": "Not found", "issues": []}Conflict
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "CONFLICT", "message": "Conflict", "issues": []}Unprocessable content
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "UNPROCESSABLE_CONTENT", "message": "Unprocessable content", "issues": []}Too many requests
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "TOO_MANY_REQUESTS", "message": "Too many requests", "issues": []}Internal server error
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "INTERNAL_SERVER_ERROR", "message": "Internal server error", "issues": []}Service unavailable
The error information
object
The error message
The error code
An array of issues that were responsible for the error
object
Example
{ "code": "SERVICE_UNAVAILABLE", "message": "Service unavailable", "issues": []}