API - Towary i usługi
Punkt dostępowy
Punkt dostępowy znajduje się pod adresem: https://app.firmino.pl/app/services/rest/api/articles/
Metody
- add – dodanie nowego produktu/usługi
- get – pobranie danych o produkcie/usłudze (wymagany id)
- find – pobranie listy produktów/usług
- update – aktualizacja danych produktu/usługi (wymagany id)
- delete – usuwanie produktu/usługi (wymagany id)
Pola
| Parametr | Opis | Wymagany | Typ danych |
|---|---|---|---|
| id | Identyfikator | long | |
| name | Nazwa produktu/usługi | Tak | string(512) |
| code | Kod produktu/usługi | Tak | string(40) |
| type | Rodzaj (good - towar, service - usługa) (domyślnie good) | string | |
| unit | Jednostka miary (domyślnie j.m. w systemie [szt]) | string(30) | |
| vatRate | Domyślna stawka VAT (23, 8, 7, 5, 0, zw, np, oo, npue, 0pp) (domyślnie 23) | string | |
| classCode | Kod klasyfikacji (PKWiU) | string(40) | |
| priceNet | Cena netto (domyślnie 0.00) | string(999.99) | |
| priceGross | Cena brutto (domyślnie 0.00) | string(999.99) | |
| quantity | Ilość w magazynie (domyślnie 0.0000) | string(999.9999) | |
| note | Notatka | string(250) |
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 |
|---|---|---|
| Typ produktu | „type” | good, service |
Przykładowe zapytania
https://app.firmino.pl/app/services/rest/api/articles/add
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/articles/add -d '{"name":"PRODUKT TESTOWY","code":"1234"}'
Żądanie (JSON):
{
"name" : "PRODUKT TESTOWY",
"code" : "1234"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 482213,
"name": "PRODUKT TESTOWY",
"code": "1234",
"type": "good",
"unit": "szt",
"vatRate": "23",
"classCode": null,
"priceNet": "0.00",
"priceGross": "0.00",
"quantity": "0.00",
"note": null
}
}
https://app.firmino.pl/app/services/rest/api/articles/add
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/articles/add -d '{"name":"TOWAR TESTOWY","code":"TEST-123","classCode":"123","type":"good","unit":"szt","vatRate":"8","quantity":"13","priceNet":"10.50","note":"Notka do towaru"}'
Żądanie (JSON):
{
"name" : "TOWAR TESTOWY",
"code" : "TEST-123",
"classCode" : "123",
"type" : "good",
"unit" : "szt",
"vatRate" : "8",
"quantity" : "13",
"priceNet" : "10.50",
"note" : "Notka do towaru"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 496332,
"name": "TOWAR TESTOWY",
"code": "TEST-123",
"type": "good",
"unit": "szt",
"vatRate": "8",
"classCode": "123",
"priceNet": "10.50",
"priceGross": "11.34",
"quantity": "13.00",
"note": "Notka do towaru"
}
}
https://app.firmino.pl/app/services/rest/api/articles/get/{id}
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/sale-documents/get/482213
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 482213,
"name": "PRODUKT TESTOWY 1234",
"code": "1234",
"type": "good",
"unit": "szt",
"vatRate": "23",
"classCode": null,
"priceNet": "0.00",
"priceGross": "0.00",
"quantity": "0.00",
"note": null
}
}
https://app.firmino.pl/app/services/rest/api/articles/find
Przykład CURL:
curl -X POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/articles/find -d '{"size":10}'
Żądanie (JSON):
{
"size" : "10"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"params": {
"total": 2,
"page": 1,
"size": 10,
"text": null,
"filters": null
},
"list": [
{
"id": 482208,
"name": "PRODUKT 1",
"code": "123-456",
"type": "good",
"unit": "szt",
"classCode": null,
"quantity": "0.00"
},
{
"id": 482213,
"name": "PRODUKT 2",
"code": "891-211",
"type": "good",
"unit": "szt",
"classCode": null,
"quantity": "0.00"
}
]
}
}
https://app.firmino.pl/app/services/rest/api/articles/find
Przykład CURL:
curl -X POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/articles/find -d '{"page":1,"size":10,"text":"TEST","filters":[{"name":"type","value":"good"}]}'
Żądanie (JSON):
{
"page" : "1",
"size" : "10",
"text" : "TEST",
"filters":
[
{
"name": "type",
"value": "good"
}
]
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"params": {
"total": 2,
"page": 1,
"size": 10,
"text": "TEST",
"filters": [
{
"name": "type",
"value": "good"
}
]
},
"list": [
{
"id": 482208,
"name": "TEST 1",
"code": "12345678",
"type": "good",
"unit": "szt",
"classCode": null,
"quantity": "0.00"
},
{
"id": 482213,
"name": "PRODUKT TESTOWY 2",
"code": "1234",
"type": "good",
"unit": "szt",
"classCode": null,
"quantity": "0.00"
}
]
}
}
https://app.firmino.pl/app/services/rest/api/articles/update
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/articles/update -d '{"name":"TOWAR TESTOWY","code":"TEST-123",
"classCode":"123","type":"good","unit":"szt","vatRate":"8","quantity":"13","priceNet":"10.50","note":"Notka do towaru"}'
Żądanie (JSON):
{
"id": 496332,
"name" : "TOWAR TESTOWY",
"code" : "TEST-123",
"classCode" : "123",
"type" : "good",
"unit" : "szt",
"vatRate" : "8",
"quantity" : "13",
"priceNet" : "10.50",
"note" : "Notka do towaru"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 496332,
"name": "TOWAR TESTOWY",
"code": "TEST-123",
"type": "good",
"unit": "szt",
"vatRate": "8",
"classCode": "123",
"priceNet": "10.50",
"priceGross": "11.34",
"quantity": "13.00",
"note": "Notka do towaru"
}
}
https://app.firmino.pl/app/services/rest/api/articles/delete/{id}
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/articles/delete/19284001
Odpowiedź (JSON):
{
"success": true,
"response": "Usunięto produkt."
}