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

Pola

ParametrOpisUwagiTyp danych
idIdentyfikatorbraklong
documentNameNazwa dokumentu (przykład: Zamówienie 1/11/2019)Tylko do odczytustring
documentDateData wystawienia dokumentu (domyślnie aktualna data)brakstring(yyyy-mm-dd)
saleDateData sprzedaży (domyślnie aktualna data)brakstring(yyyy-mm-dd)
salePlaceMiejsce sprzedaży (domyślnie miejsce prowadzenia firmy)brakstring(60)
notesUwagi do dokumentubrakstring
printNotesUwagi do wydrukubrakstring
finalDocumentTypeTyp dokumentu

Dostępne:
  • fas - Faktura sprzedaży (domyślny dla podatnika vat)
  • fe - Faktura eksportowa
  • fhan - Rachunek (domyślny dla nie podatnika vat)
  • par - Paragon VAT
  • pa - Paragon
  • fdw - dostawa wewnątrzwspólnotowa

Nieedytowalnystring
documentStateStatus dokumentu (domyślnie "new" - Nowy, wystawiony)

Dostępne:
  • new - nowy
  • printed - wydrukowany
  • partpaid - częściowo zapłacony
  • paid - zapłacony
  • cancelled - anulowany
  • unpaid - niezapłacony

Tylko do odczytustring
priceTypeDokument liczony od Netto lub Brutto (domyślnie "net")

Dostępne:
  • net - netto
  • gross - brutto

brakstring

Pozostałe pola

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": 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": 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"
            },
            {
                "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"
            },
            {
                "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"
            }
        ]
    }
}

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"
            }      
     ]
    }
}

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",
                "unit": "szt",
                "vatRate": "23",
                "gtu": null,
                "price": "12.00",
                "quantity": "3.0000",
                "discount": 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/similar/{id}

Odpowiedź (JSON)
– Zwracany jest plik PDF o nazwie „dokument_id.pdf”