API - Dokumenty Zakupowe
Punkt dostępowy
Punkt dostępowy znajduje się pod adresem: https://app.firmino.pl/app/services/rest/api/purchase-documents/
Metody
- add – dodawanie nowego dokumentu
- get – pobieranie danych dokumentu (wymagany id)
- find – pobieranie listy dokumentów
- update – aktualizowanie danych dokumentu (wymagany id)
- delete – usuwanie dokumentu (wymagany id)
- init – inicjalizowanie pustego dokumentu (zwraca dostępny numer porządkowy i domyślne ustawienia)
- payoff – spłata dokumentu
Pola
| Parametr | Opis | Uwagi | Typ danych |
|---|---|---|---|
| id | Identyfikator | long | |
| documentName | Nazwa dokumentu (przykład: Zamówienie 1/11/2019) | Tylko do odczytu | string |
| externalDocument | Dokument zewnętrzny | string | |
| documentDate | Data wystawienia dokumentu (domyślnie aktualna data) | string(yyyy-mm-dd) | |
| saleDate | Data sprzedaży (domyślnie aktualna data) | string(yyyy-mm-dd) | |
| notes | Uwagi do dokumentu | string | |
| documentType | Typ dokumentu (domyślnie "faz" - faktura zakupu) Dostępne:
| string | |
| documentState | Typ dokumentu Status dokumentu (domyślnie "new" - Nowy, wystawiony) Dostępne:
| Tylko do odczytu | string |
| priceType | Dokument liczony od Netto lub Brutto (domyślnie "net") Dostępne:
| string |
Pozostałe pola
- kontrahent (customer)
- pozycje dokumentu (items)
- waluta + kurs (currency)
- rozliczenie dokumentu (payment)
Przykładowe zapytania
https://app.firmino.pl/app/services/rest/api/purchase-documents/add
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/purchase-documents/add -d '{"customer": {"id": 4640700}, "items":[{"name": "PRODUKT X", "quantity": "1", "price": "21.22", "unit": "szt"}]}'
Żądanie (JSON):
{
"externalDocument": "Testowy dokument",
"customer" : {
"id": 4640700
},
"items":
[
{
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"price": "21.22",
"quantity": "1"
}
]
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 37280,
"externalDocument": "Testowy dokument",
"purchaseDate": "2022-09-30",
"documentDate": "2022-09-30",
"priceType": "net",
"documentType": "faz",
"documentName": "Faktura zakupu - Testowy dokument",
"documentFunction": "normal",
"documentState": "new",
"items": [
{
"orderNo": 1,
"idArticle": null,
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"price": "21.22",
"quantity": "1.0000",
"discount": "0.00"
}
],
"customer": {
"id": 4640700,
"fullName": "Kontrahent Testowy",
"shortName": "KONTRAHENT TEST",
"countryCode": "PL",
"locality": "Warszawa",
"tin": null,
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "Warszawa",
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2022-10-14",
"total": "26.10",
"paid": "0.00",
"ramain": "26.10"
},
"notes": null
}
}
https://app.firmino.pl/app/services/rest/api/purchase-documents/init
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/purchase-documents/init -d '{"documentDate":"2020-01-01","documentType":"fas"}'
Żądanie (JSON):
{
"documentDate" : "2020-01-01",
"documentType" : "faz"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": null,
"externalDocument": null,
"purchaseDate": "2020-01-01",
"documentDate": "2020-01-01",
"priceType": "net",
"documentType": "faz",
"documentName": "Faktura zakupu",
"documentFunction": "normal",
"documentState": "new",
"items": [],
"customer": {
"id": null,
"fullName": null,
"shortName": null,
"countryCode": "PL",
"locality": null,
"tin": null,
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": null,
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2022-10-14",
"total": "0.00",
"paid": "0.00",
"ramain": "0.00"
},
"notes": null
}
}
https://app.firmino.pl/app/services/rest/api/purchase-documents/find
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/purchase-documents/find -d '{"page":1,"size":10,"text":"","filters":[{"name":"year","value":2019}]}'
Żądanie (JSON):
{
"page" : 1,
"size" : 10,
"text" : "",
"filters":
[
{
"name": "year",
"value": 2019
}
]
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"params": {
"total": 1,
"page": 1,
"size": 10,
"sortField": null,
"sortOrder": null,
"text": "",
"filters": [
{
"name": "year",
"value": "2019"
}
]
},
"list": [
{
"id": 37206,
"documentName": "Testowy33",
"documentDate": "2019-09-13",
"idCustomer": 4640002,
"customerName": "Testowy 6",
"documentType": "FI",
"documentFunction": "normal",
"documentState": "new",
"currencyCode": "USD",
"paymentTotal": "26.10",
"paymentPaid": "0.00",
"paymentRemain": "21.22"
}
]
}
}
https://app.firmino.pl/app/services/rest/api/purchase-documents/update
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/purchase-documents/update -d {"id":37206,"externalDocument":"Testowy poprawiony", "purchaseDate":"2019-09-14", "documentDate":"2019-09-14", "priceType":"net", "documentType":"fi"}}
Żądanie (JSON):
{
"id": 37206,
"externalDocument": "Testowy poprawiony",
"purchaseDate": "2019-09-14",
"documentDate": "2019-09-14",
"priceType": "net",
"documentType": "fi"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 37206,
"externalDocument": "Testowy poprawiony",
"purchaseDate": "2019-09-14",
"documentDate": "2019-09-14",
"priceType": "net",
"documentType": "fi",
"documentName": "Faktura importowa - Testowy poprawiony",
"documentFunction": "normal",
"documentState": "new",
"items": [],
"customer": {
"id": 4640002,
"fullName": "Kontrahent Testowy",
"shortName": "KONTRAHENT TEST",
"countryCode": "US",
"locality": "Warszawa",
"tin": null,
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "Warszawa",
"phone": null,
"email": "m.wojtczak@streamsoft.pl;",
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2022-10-11",
"total": "0",
"paid": "0.00",
"ramain": "0.00"
},
"notes": null
}
}
https://app.firmino.pl/app/services/rest/api/purchase-documents/payoff/{id}
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/purchase-documents/payoff/3112414
Odpowiedź (JSON):
{
"success": true,
"response": "Dokument został spłacony."
}
https://app.firmino.pl/app/services/rest/api/purchase-documents/delete/{id}
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/purchase-documents/delete/19284001
Odpowiedź (JSON):
{
"success": true,
"response": "Usunięto dokument."
}