3.22. Get document
Connection URL
TEST URL | http://nap.dev.icash.bg/clientapi/v1/get-document |
( AL ) PRODUCTION URL | https://v1.icash.al/clientapi/v1/get-document |
( BG ) PRODUCTION URL | https://v5.icash.bg/clientapi/v1/get-document |
POST REQUEST
Param | Description | Field type | Required. |
api_key | API Key | String | YES |
nonce | Nonce | Integer | YES |
signature | Signature | String | YES |
ses | Session indentificator | String | YES |
DocumentID | Indentificator на документа | Integer | No/YES |
JSON response on success
Param | Description | Field type | Required |
nonce | Nonce from request | Integer | YES |
status | Request status | Integer
1 – successful |
YES |
data | Result | document | YES |
Structure of type “document”
Param | Description | Field type | Required |
DocumentID | Document ID | Integer | YES |
DocumentStatus | Status | ENUM(NORMAL,DELETED)
Default NORMAL |
YES |
DocumentNum | Document number | Integer | YES |
DocumentType | INVOICE
PROFORMA |
ENUM(INVOICE,PROFORMA) | YES |
DocumentStoreID | Store ID | Integer | YES |
DocumentOperationID | ID of operation | Integer | YES |
DocumentOperationType | Type of operation | ENUM(NORMAL,FINANCIAL) | YES |
DocumentSubType | Sub Type of document | ENUM(NORMAL,CREDIT,DEBIT) | YES |
DocumentDate | Document date | STRING(YYYY-MM-DD) | YES |
DocumentFirmName | Company name | String | YES |
DocumentFirmAddress | Company address | String | YES |
DocumentFirmMOL | Company manager | String | YES |
DocumentFirmEIK | Company Number | String | YES |
DocumentContragentID | Customer ID | Integer | YES |
DocumentContragentName | Customer name | String | YES |
DocumentContragentAddress | Customer address | String | YES |
DocumentContragentMOL | Customer manager | String | YES |
DocumentContragentTaxNum | Customer company ID | String | YES |
DocumentContragentTaxNumVatReg | Customer Tax Number | String | YES |
DocumentToDocumentID | Reffer document ID (Credit/Debit) | Integer | YES |
DocumentToDocumentDate | Reffer document date number (Credit/Debit) | String
(YYYY-MM-DD) |
YES |
DocumentPriceBase | Bse price | DECIMAL(15,2) | YES |
DocumentDiscount | Disccount % | DECIMAL(7,5) | YES |
DocumentTotalPrice | Total price | DECIMAL(15,2) | YES |
DocumentTotalPriceTxt | Amount text | String | YES |
DocumentCurrencyCode | Currency | String | YES |
DocumentPayTypeID | Pay type ID | Integer | YES |
DocumentPayDate | Pay date | String
(YYYY-MM-DD) |
YES |
DocumentBankAccountID | Bank account ID | Integer | YES |
DocumentBankAccountBankName | Bank name | String | YES |
DocumentBankAccountIBAN | IBAN | String | YES |
DocumentBankAccountBIC | BIC | String | YES |
DocumentBankAccountCurrencyCode | Bank currency | String | YES |
DocumentAcceptedBy | Accepted by | String | YES |
DocumentCreatedBy | ПреYESл | String | YES |
DocumentCreateUserID | Indentificator на поребителя съзYESл документа | Integer | YES |
DocumentCreateDate | Date of creation | String
(YYYY-MM-DD) |
YES |
DocumentVatReason | Tax condition | String | YES |
DocumentComment | Comment | String | YES |
DocumentServices | Редове на фактурата | service | YES |
Structure of type “service”
Param | Description | Field type | Required |
DocumentServiceSaleItemID | Indentificator на артикула | Integer | YES |
DocumentServiceDescription | Description on Product/Service | String | YES |
DocumentServiceMeasureUnitID | Indentificator on measure unit | Integer | YES |
DocumentServiceMeasureUnitName | Name of measure unit | String | YES |
DocumentServiceVatPercent | TAX % | DECIMAL(7,5) | YES |
DocumentServiceTaxGroupID | Indentificator tax group | Integer | YES |
DocumentServiceSinglePrice | Unit price | DECIMAL(19,6) | YES |
DocumentServiceQty | Quantity | DECIMAL(10,5) | YES |
DocumentServiceDiscount | Discount % | DECIMAL(7,5) | YES |
DocumentServiceTotalPrice | Total price | DECIMAL(15,2) | YES |
DocumentServiceCreateUserID | User indentificator | Integer | YES |
DocumentServiceCreateDate | Create date | String
(YYYY-MM-DD HH:MM:SS) |
YES |
Example:
{ „nonce“: „1553263542“, „status“: 1, „data“: { „DocumentID“: 1, „DocumentStatus“: „NORMAL“, „DocumentNum“: 1, „DocumentType“: „INVOICE“, „DocumentStoreID“: null, „DocumentOperationID“: 34314, „DocumentOperationType“: „NORMAL“, „DocumentSubType“: „NORMAL“, „DocumentDate“: „2016-09-26“, „DocumentFirmName“: „Concord company Ltd.“, „DocumentFirmAddress“: „Noсебър, Address line 1“, „DocumentFirmMOL“: „Company manager“, „DocumentFirmEIK“: „1234567890“, „DocumentContragentID“: 25, „DocumentContragentName“: „Investment Holding Ltd“, „DocumentContragentAddress“: „New York, P.O3434 „, „DocumentContragentMOL“: „John Smith“, „DocumentContragentTaxNum“: „115825956“, „DocumentContragentTaxNumVatReg“: „BG115825956“, „DocumentToDocumentID“: 0, „DocumentToDocumentDate“: „0000-00-00“, „DocumentPriceBase“: „20.00“, „DocumentDiscount“: „0.00000“, „DocumentTotalPrice“: „24.00“, „DocumentTotalPriceTxt“: „Twenti four EUR and 00“, „DocumentCurrencyCode“: „EUR“, „DocumentPayTypeID“: 1, „DocumentPayDate“: „2016-09-17“, „DocumentBankAccountID“: 0, „DocumentBankAccountBankName“: „“, „DocumentBankAccountIBAN“: „“, „DocumentBankAccountBIC“: „“, „DocumentBankAccountCurrencyCode“: „EUR“, „DocumentAcceptedBy“: „“, „DocumentVatReason“: „Text of vat reason“, „DocumentCreatedBy“: „John Smith“, „DocumentCreateUserID“: 1, „DocumentCreateDate“: „2016-09-26 12:02:32“, „DocumentComment“: „“, „DocumentServices“: [ { „DocumentServiceSaleItemID“: 36978, „DocumentServiceDescription“: „Ножици за педикюр \“\“Твърди нокти\“\“\““, „DocumentServiceMeasureUnitID“: 1, „DocumentServiceMeasureUnitName“: „бр.“, „DocumentServiceVatPercent“: 20, „DocumentServiceTaxGroupID“: 2, „DocumentServiceSinglePrice“: „20.000000“, „DocumentServiceQty“: „1.00000“, „DocumentServiceDiscount“: „0.00000“, „DocumentServiceTotalPrice“: „20.00“, „DocumentServiceCreateUserID“: 1, „DocumentServiceCreateDate“: „2016-09-26 12:02:32“ } ] } } |
JSON response on unsuccess
Param | Description | Field type | Required |
nonce | Nonce from request | Integer | YES |
status | Request status | Integer
0 – unsuccess request |
YES |
error_message | Error Description | String | YES |
Example:
{ „nonce“: „1552990901“, „status“: 0, „error_message“: „Session expired“ } |
Live example:
In this example, 3 methods of API are used 1. login – to authorise in API 2. documents-list – to take a list of documents from the last 30 days. Pay attention to the attributes DocumentDateFrom, DocumentDateTo – limiting the search period. 3. get-document – with which the detailed information about the document is taken function 3 is executed in a loop as long as there are documents from the period.Click here to view example in new tab |