API - Zamówienia
Punkt dostępowy
Punkt dostępowy znajduje się pod adresem: https://app.firmino.pl/app/services/rest/api/order-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)
- download – pobieranie dokumentu jako PDF (wymagany id)
- mail – wysyłanie maila z dołączonym dokumentem sprzedaży PDF (wymagany id)
- similar – wystawienie zamówienia na podstawie innego zamówienia
- init-advance – inicjowanie zaliczki do zamówienia
- add-advance – przyjęcie zaliczki do zamówienia
- init-end-doc – inicjowanie dokumentu końcowego do zamówienia
- add-end-doc – wystawianie dokumentu końcowego do zamówienia
- complete – zrealizowanie zamówienia
Pola
| Parametr | Opis | Uwagi | Typ danych |
|---|---|---|---|
| id | Identyfikator | brak | long |
| documentName | Nazwa dokumentu (przykład: Zamówienie 1/11/2019) | Tylko do odczytu | string |
| documentDate | Data wystawienia dokumentu (domyślnie aktualna data) | brak | string(yyyy-mm-dd) |
| saleDate | Data sprzedaży (domyślnie aktualna data) | brak | string(yyyy-mm-dd) |
| salePlace | Miejsce sprzedaży (domyślnie miejsce prowadzenia firmy) | brak | string(60) |
| notes | Uwagi do dokumentu | brak | string |
| printNotes | Uwagi do wydruku | brak | string |
| finalDocumentType | Typ dokumentu Dostępne:
| Nieedytowalny | string |
| documentState | 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:
| brak | string |
Pozostałe pola
- kontrahent (customer)
- pozycje dokumentu (items)
- waluta + kurs (currency)
- rozliczenie dokumentu (payment)
Filtry
Obiekt filtrów
{
"sortField": "fieldName",
"sortOrder": "desc",
"text": "searchText",
"filters": [
{
"name": "filterName",
"value": "filterValue"
}
]
}
Dostępne filtry
| Opis | Nazwa filtru | Dostępne wartości |
|---|---|---|
| Od daty | „fromDate” | wartości daty w formacie "RRRR-MM-DD" |
| Do daty | „toDate” | wartości daty w formacie "RRRR-MM-DD" |
| Po roku | „year” | dostępne wartości integer |
| Po miesiącu | „month” | dostępne wartości integer |
| Stan dokumentu | „documentState” | dostępne wartości: new, printed, partpaid, paid, cancelled, unpaid, sended, editrequired |
| Grupa zamówień | „ordersGroup" | dostępne wartości: current, completed |
Przykładowe zapytania
https://app.firmino.pl/app/services/rest/api/order-documents/add
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/add -d '{"customer":{"id":4640700}}'
Żądanie (JSON):
{
"customer" : {
"id": 4640700
}
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 19829900,
"ordinalNumber": 26,
"documentName": "Zamówienie 26/09/2022",
"documentDate": "2022-09-30",
"saleDate": "2022-09-30",
"salePlace": "Zielona Góra",
"documentType": "zamo",
"documentFunction": "order",
"documentState": "new",
"priceType": "gross",
"customer": {
"id": 4640700,
"fullName": "Kontrahent Testowy",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "PL",
"locality": "Lubin",
"tin": null,
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "Lubin",
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"items": [],
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2022-10-14",
"total": "0",
"paid": "0.00",
"ramain": "0.00"
},
"notes": null,
"printNotes": null,
"finalDocumentType": "fas"
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/add
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/add -d '{"customer": {"id": 4636800}, "items":[{"name": "PRODUKT X", "quantity": "1", "price": "21.22", "unit": "szt"}]}'
Żądanie (JSON):
{
"documentDate": "2019-09-13",
"ordinalNumber": 2,
"customer": {
"id" : 4636800
},
"finalDocumentType": "fas",
"items":
[
{
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"price": "21.22",
"quantity": "1"
}
]
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 19829901,
"ordinalNumber": 22,
"documentName": "Zamówienie 22/09/2019",
"documentDate": "2019-09-13",
"saleDate": "2019-09-13",
"salePlace": "Zielona Góra",
"documentType": "zamo",
"documentFunction": "order",
"documentState": "new",
"priceType": "gross",
"customer": {
"id": 4640700,
"fullName": "Kontrahent Testowy",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "PL",
"locality": "Lubin",
"tin": null,
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "Lubin",
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"items": [
{
"orderNo": 1,
"idArticle": null,
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"gtu": null,
"price": "21.22",
"quantity": "1.0000",
"discount": "0.00",
"classCode": null,
"storeCode": null,
"articleType": null
}
],
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2019-09-27",
"total": "21.22",
"paid": "0.00",
"ramain": "21.22"
},
"notes": null,
"printNotes": null,
"finalDocumentType": "fas"
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/get/19818901
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/get/3112414
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 19829901,
"ordinalNumber": 22,
"documentName": "Zamówienie 22/09/2019",
"documentDate": "2019-09-13",
"saleDate": "2019-09-13",
"salePlace": "Zielona Góra",
"documentType": "zamo",
"documentFunction": "order",
"documentState": "new",
"priceType": "gross",
"customer": {
"id": 4640700,
"fullName": "Kontrahent Testowy",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "PL",
"locality": "LUBIN",
"tin": null,
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "Lubin",
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"items": [
{
"orderNo": 1,
"idArticle": null,
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"gtu": null,
"price": "21.22",
"quantity": "1.0000",
"discount": "0.00",
"classCode": null,
"storeCode": null,
"articleType": null
}
],
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2019-09-27",
"total": "21.22",
"paid": "0.00",
"ramain": "21.22"
},
"notes": null,
"printNotes": null,
"finalDocumentType": "fas"
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/find
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/find -d '{}'
Odpowiedź (JSON):
{
"success": true,
"response": {
"params": {
"total": 3,
"page": 1,
"size": 15,
"text": null,
"filters": null
},
"list": [
{
"id": 2924781,
"ordinalNumber": 1,
"documentName": "FAS 1/11/2019",
"documentDate": "2019-11-27",
"idCustomer": 765012,
"customerName": "Testowy kontrahent sp. z o.o.",
"documentType": "fas",
"documentFunction": "normal",
"documentState": "new",
"currencyCode": "PLN",
"paymentTotal": "0.00",
"paymentPaid": "0.00",
"paymentRemain": "0.00",
"orderState": "issued",
"orderStateLabel": "Wystawione"
},
{
"id": 3098578,
"ordinalNumber": 3,
"documentName": "FAS 3/09/2019",
"documentDate": "2019-09-13",
"idCustomer": 765012,
"customerName": "Testowy kontrahent sp. z o.o.",
"documentType": "fas",
"documentFunction": "normal",
"documentState": "new",
"currencyCode": "PLN",
"paymentTotal": "26.10",
"paymentPaid": "0.00",
"paymentRemain": "26.10",
"orderState": "issued",
"orderStateLabel": "Wystawione"
},
{
"id": 2707213,
"ordinalNumber": 1,
"documentName": "FAS 1/09/2019",
"documentDate": "2019-09-13",
"idCustomer": 738023,
"customerName": "KONTRAHENT 1 - TEST",
"documentType": "fas",
"documentFunction": "normal",
"documentState": "paid",
"currencyCode": "PLN",
"paymentTotal": "0.00",
"paymentPaid": "0.00",
"paymentRemain": "0.00",
"orderState": "issued",
"orderStateLabel": "Wystawione"
}
]
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/find
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-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": 19829901,
"ordinalNumber": 22,
"documentName": "ZAMO 22/09/2019",
"documentDate": "2019-09-13",
"idCustomer": 4640700,
"customerName": "Testowy 9",
"documentType": "zamo",
"documentFunction": "order",
"documentState": "new",
"currencyCode": "PLN",
"paymentTotal": "21.22",
"paymentPaid": "0.00",
"paymentRemain": "21.22",
"orderState": "issued",
"orderStateLabel": "Wystawione"
}
]
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/update
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/update -d '{"id":19340101,"ordinalNumber":7,"documentDate":"2020-02-15","saleDate":"2020-02-15","salePlace":"Warszawa","priceType":"gross","customer":{"fullName":"KONTRAHENT NOWY","shortName":"EDYTOWANY","countryCode":"PL","locality":"Poznań","postCode":"60-001","note":"edytowany"},"items":[{"name":"PRODUKT","unit":"szt","vatRate":"23","price":"12.00","quantity":"3.00","discount":"0.00"}],"currency":{"code":"EUR"},"payment":{"method":"cash","termDate":"2020-02-22"}}'
Żądanie (JSON):
{
"id" : 19829004,
"ordinalNumber": 7,
"documentDate": "2020-02-15",
"saleDate": "2020-02-15",
"salePlace": "Warszawa",
"priceType": "gross",
"customer": {
"fullName": "KONTRAHENT NOWY",
"shortName": "EDYTOWANY",
"countryCode": "PL",
"locality": "Poznań",
"postCode": "60-001",
"note": "edytowany"
},
"items": [
{
"name": "PRODUKT",
"unit": "szt",
"vatRate": "23",
"price": "12.00",
"quantity": "3.00",
"discount": "0.00"
}
],
"currency": {
"code": "EUR"
},
"payment": {
"method": "cash",
"termDate": "2020-02-22"
}
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 19829004,
"ordinalNumber": 7,
"documentName": "Zamówienie 7/02/2020",
"documentDate": "2020-02-15",
"saleDate": "2020-02-15",
"salePlace": "Warszawa",
"documentType": "zamo",
"documentFunction": "order",
"documentState": "new",
"priceType": "gross",
"customer": {
"id": 4641300,
"fullName": "KONTRAHENT NOWY",
"shortName": "EDYTOWANY",
"countryCode": "PL",
"locality": "Poznań",
"tin": null,
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": "60-001",
"post": "Poznań",
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": "edytowany"
},
"items": [
{
"orderNo": 1,
"idArticle": null,
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"gtu": null,
"price": "21.22",
"quantity": "1.0000",
"discount": "0.00",
"classCode": null,
"storeCode": null,
"articleType": null
}
],
"currency": {
"code": "EUR",
"rate": "4.240200",
"date": "2020-02-14",
"table": "031/A/NBP/2020"
},
"payment": {
"method": "cash",
"paymentDate": null,
"termDate": "2020-02-22",
"total": "36.00",
"paid": "0.00",
"ramain": "36.00"
},
"notes": null,
"printNotes": null,
"finalDocumentType": "fas"
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/delete/19818903
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/delete/19284001
Odpowiedź (JSON)
{
"success": true,
"response": "Usunięto dokument."
}
https://app.firmino.pl/app/services/rest/api/order-documents/init
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/init -d '{"documentDate":"2020-01-01"}'
Żądanie (JSON):
{
"documentDate" : "2020-01-01"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": null,
"ordinalNumber": 1,
"documentName": "Zamówienie 1/01/2020",
"documentDate": "2020-01-01",
"saleDate": "2020-01-01",
"salePlace": "Zielona Góra",
"documentType": "zamo",
"documentFunction": "order",
"documentState": "new",
"priceType": "gross",
"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
},
"items": [],
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2020-01-15",
"total": "0.00",
"paid": "0.00",
"ramain": "0.00"
},
"notes": null,
"printNotes": null,
"finalDocumentType": "fas"
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/mail
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/mail -d '{"idDocument":3112414,"mail":"pomoc@firmino.pl","title":"Tytuł maila","content":"Treść maila"}'
Żądanie (JSON):
{
"idDocument" : 3112414,
"mail" : "pomoc@firmino.pl",
"title" : "Tytuł maila",
"content" : "Treść maila"
}
Odpowiedź (JSON)
{
"success": true,
"response": {
"idDocument": 3112414,
"documentName": "Zamówienie 8/01/2020",
"mail": "pomoc@firmino.pl"
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/download/{id}
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/download/3112414
Odpowiedź
– Zwracany jest plik PDF o nazwie „dokument_id.pdf”
https://app.firmino.pl/app/services/rest/api/order-documents/init-end-doc
Przykład CURL:
https://app.firmino.pl/app/services/rest/api/order-documents/init-end-doc -d '{"idOrder":19871300}'
Żądanie (JSON):
{
"idOrder": 19871403
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": null,
"idOrder": 19871403,
"documentName": "Faktura VAT 4/08/2023",
"documentDate": "2023-08-03",
"documentQuota": "18450.00"
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/add-end-doc
Przykład CURL:
https://app.firmino.pl/app/services/rest/api/order-documents/add-end-doc -d '{"idOrder":19871300}'
Żądanie (JSON):
{
"idOrder": 19872302
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 19871303,
"ordinalNumber": 11,
"documentName": "Faktura VAT 11/02/2023",
"documentDate": "2023-02-28",
"saleDate": "2023-08-03",
"salePlace": "Zielona Góra",
"documentType": "fas",
"documentFunction": "normal",
"documentState": "new",
"priceType": "net",
"customer": {
"id": 4655801,
"fullName": "TestowyKontrahent5",
"shortName": "TESTOWYKONTRAHENT5",
"countryCode": "PL",
"locality": "MiejscowoscTestowa5",
"tin": "5352307266",
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "MiejscowoscTestowa",
"county": null,
"commune": null,
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"items": [
{
"orderNo": 1,
"idArticle": null,
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"gtu": null,
"price": "21.22",
"quantity": "1.0000",
"discount": "0.00",
"classCode": null,
"storeCode": null,
"articleType": null
}
],
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2023-03-14",
"total": "4305.00",
"paid": "0.00",
"ramain": "4305.00"
},
"notes": null,
"printNotes": null
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/init-advance
Przykład CURL:
https://app.firmino.pl/app/services/rest/api/order-documents/init-advance -d '{"idOrder":19871300}'
Żądanie (JSON):
{
"idOrder": 19871403
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"quota": "0",
"orderQuota": "18450.00",
"previousAdvanceQuota": "0",
"leftToPay": "18350.00",
"idCorrectionSource": null,
"idCurrency": 1,
"idOrder": 19871403,
"saleDocument": {
"id": null,
"ordinalNumber": 1,
"documentName": "Zaliczka 1/08/2023",
"documentDate": "2023-08-03",
"saleDate": "2023-08-03",
"salePlace": "Zielona Góra",
"documentType": "fzal",
"documentFunction": "advance",
"documentState": "new",
"priceType": "gross",
"customer": {
"id": 4655801,
"fullName": "TestowyKontrahent5",
"shortName": "TESTOWYKONTRAHENT5",
"countryCode": "PL",
"locality": "MiejscowoscTestowa5",
"tin": "5352307266",
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "MiejscowoscTestowa",
"county": null,
"commune": null,
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"items": [
{
"orderNo": 1,
"idArticle": null,
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"gtu": null,
"price": "21.22",
"quantity": "1.0000",
"discount": "0.00",
"classCode": null,
"storeCode": null,
"articleType": null
}
],
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2023-08-17",
"total": "100.00",
"paid": "0.00",
"ramain": "100.00"
},
"notes": null,
"printNotes": null
}
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/add-advance
Przykład CURL:
https://app.firmino.pl/app/services/rest/api/order-documents/add-advance -d '{"quota": "100", "idOrder": "19871700"}'
Żądanie (JSON):
{
"quota": "100",
"idOrder": 19871700
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"quota": "100.00",
"orderQuota": "18450.00",
"previousAdvanceQuota": "0.00",
"leftToPay": "18450.00",
"idCorrectionSource": null,
"idCurrency": 1,
"idOrder": 19871403,
"saleDocument": {
"id": 19871500,
"ordinalNumber": 1,
"documentName": "Zaliczka 1/08/2023",
"documentDate": "2023-08-03",
"saleDate": "2023-08-03",
"salePlace": "Zielona Góra",
"documentType": "fzal",
"documentFunction": "advance",
"documentState": "new",
"priceType": "gross",
"customer": {
"id": 4655801,
"fullName": "TestowyKontrahent5",
"shortName": "TESTOWYKONTRAHENT5",
"countryCode": "PL",
"locality": "MiejscowoscTestowa5",
"tin": "5352307266",
"regon": null,
"street": null,
"houseNo": null,
"flatNo": null,
"postCode": null,
"post": "MiejscowoscTestowa",
"county": null,
"commune": null,
"phone": null,
"email": null,
"bankAccount": null,
"fax": null,
"website": null,
"note": null
},
"items": [
{
"orderNo": 1,
"idArticle": null,
"name": "PRODUKT X",
"unit": "szt",
"vatRate": "23",
"gtu": null,
"price": "21.22",
"quantity": "1.0000",
"discount": "0.00",
"classCode": null,
"storeCode": null,
"articleType": null
}
],
"currency": {
"code": "PLN",
"rate": "1.000000",
"date": null,
"table": null
},
"payment": {
"method": "transfer",
"paymentDate": null,
"termDate": "2023-08-17",
"total": "100.00",
"paid": "0.00",
"ramain": "100.00"
},
"notes": null,
"printNotes": null
}
}
}
https://app.firmino.pl/app/services/rest/api/order-documents/complete/19818903
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/order-documents/complete/19284001
Odpowiedź (JSON):
{
"success": true,
"response": "Zrealizowano zamówienie"
}