API - Kontrahenci
Punkt dostępowy
Punkt dostępowy znajduje się pod adresem: https://app.firmino.pl/app/services/rest/api/customers/
Metody
- add – dodanie nowego kontrahenta
- get – pobranie danych kontrahenta (wymagany id)
- find – pobranie listy kontrahentów
- update – aktualizowanie danych kontrahenta (wymagany id)
- delete – usuwanie kontrahenta (wymagany id)
- gus – pobranie danych kontrahenta z bazy GUS (wymagany NIP)
Pola
| Parametr | Opis | Wymagany | Typ danych |
|---|---|---|---|
| id | Identyfikator | long | |
| fullName | Pełna nazwa kontrahenta | Tak | string(500) |
| shortName | Nazwa skrócona (unikalna) | Tak | string(25) |
| locality | Miejscowość | Tak | string(30) |
| countryCode | Kod ISO kraju, domyślnie Polska (PL) | string(2) | |
| tin | NIP (sprawdzana poprawność dla kontrahentów z Polski) | string(20) | |
| regon | REGON (sprawdzana poprawność) | string(30) | |
| street | Ulica | string(120) | |
| houseNo | Nr domu | string(10) | |
| flatNo | Nr mieszkania | string(10) | |
| postCode | Kod pocztowy | string(30) | |
| post | Poczta | string(100) | |
| phone | Numer telefonu | string(50) | |
| Adres mailowy | string(250) | ||
| bankAccount | Nr rachunku bankowego (sprawdzana poprawność dla kont z Polski) | string(40) | |
| fax | Numer faxu | string(20) | |
| website | Adres strony internetowej | string(100) | |
| 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 |
|---|---|---|
| Kod kraju | „countryCode” | dwuliterowe kody krajów np. ”PL” |
Przykładowe zapytania
https://app.firmino.pl/app/services/rest/api/customers/add
Przykład CURL:
curl -X POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/customers/add -d '{"fullName":"Testowy kontrahent sp. z o.o.","shortName":"KONTRAHENT TEST","locality":"Warszawa"}'
Żądanie (JSON):
{
"fullName" : "Testowy kontrahent sp. z o.o.",
"shortName" : "KONTRAHENT TEST",
"locality" : "Warszawa"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 765012,
"fullName": "Testowy kontrahent sp. z o.o.",
"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
}
}
https://app.firmino.pl/app/services/rest/api/customers/add
Przykład CURL:
curl -X POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/customers/add -d '{"fullName":"Testowy kontrahent","shortName":"KONTRAHENT TESTOWY","locality":"Zielona Góra","countryCode":"PL","tin":"929-185-17-23","regon":"081108705","street":"al.WojskaPolskiego","houseNo":"11","flatNo":"","postCode":"65-077","post":"ZielonaGóra","phone":"+48 68 45 66 900","email":"handelpro@streamsoft.pl","bankAccount":"52 1140 1850 0000 2403 1700 1001","fax":"+48 68 45 66 933","website":"www.streamsoft.pl","note":"Uwagi na temat kontrahenta"}'
Żądanie (JSON):
{
"fullName" : "Testowy kontrahent",
"shortName" : "KONTRAHENT TESTOWY",
"locality" : "Zielona Góra",
"countryCode" : "PL",
"tin" : "929-185-17-23",
"regon" : "081108705",
"street" : "al. Wojska Polskiego",
"houseNo" : "11",
"flatNo" : "",
"postCode" : "65-077",
"post" : "Zielona Góra",
"phone" : "+48 68 45 66 900",
"email" : "handelpro@streamsoft.pl",
"bankAccount" : "52 1140 1850 0000 2403 1700 1001",
"fax" : "+48 68 45 66 933",
"website" : "www.streamsoft.pl",
"note" : "Uwagi na temat kontrahenta"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 4556505,
"fullName": "Testowy kontrahent",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "PL",
"locality": "Zielona Góra",
"tin": "929-185-17-23",
"regon": "081108705",
"street": "al. Wojska Polskiego",
"houseNo": "11",
"flatNo": null,
"postCode": "65-077",
"post": "Zielona Góra",
"phone": "+48 68 45 66 900",
"email": "handelpro@streamsoft.pl",
"bankAccount": "52 1140 1850 0000 2403 1700 1001",
"fax": "+48 68 45 66 933",
"website": "www.streamsoft.pl",
"note": "Uwagi na temat kontrahenta"
}
}
https://app.firmino.pl/app/services/rest/api/customers/get/{id}
Przykład CURL:
curl -X POST --user login:haslo https://app.firmino.pl/app/services/rest/api/sale-documents/get/4556505
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 4556505,
"fullName": "Testowy kontrahent",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "PL",
"locality": "Zielona Gora",
"tin": "929-185-17-23",
"regon": "081108705",
"street": "al. Wojska Polskiego",
"houseNo": "11",
"flatNo": null,
"postCode": "65-077",
"post": "Zielona Góra",
"phone": "+48 68 45 66 900",
"email": "handelpro@streamsoft.pl",
"bankAccount": "52 1140 1850 0000 2403 1700 1001",
"fax": "+48 68 45 66 933",
"website": "www.streamsoft.pl",
"note": "Uwagi na temat kontrahenta"
}
}
https://app.firmino.pl/app/services/rest/api/customers/find
Przykład CURL:
curl -X POST --user login:hasło -H "Content-Type: application/json" https://app.firmino.pl/app/services/rest/api/customers/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": 4556505,
"fullName": "Testowy kontrahent",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "PL",
"locality": "Zielona Gora",
"tin": "929-185-17-23"
},
{
"id": 4220208,
"fullName": "Testowy kontrahent2",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "US",
"locality": "New York",
"tin": "111-111-11-11"
}
]
}
}
https://app.firmino.pl/app/services/rest/api/customers/find
Przykład CURL:
curl -X POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/customers/find -d '{"page":1,"size":10,"text":"TEST","filters":[{"name":"countryCode","value":"US"}]}'
Żądanie (JSON):
{
"page" : 1,
"size" : 10,
"text" : "TEST",
"filters":
[
{
"name": "countryCode",
"value": "US"
}
]
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"params": {
"total": 1,
"page": 1,
"size": 10,
"text": "TEST",
"filters": [
{
"name": "countryCode",
"value": "US"
}
]
},
"list": [
{
"id": 4553700,
"fullName": "TESTOWY USA",
"shortName": "USA-TEST",
"countryCode": "US",
"locality": "Chicago",
"tin": "111-11-11-111"
}
]
}
}
https://app.firmino.pl/app/services/rest/api/customers/update
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/customers/update -d '{"id":4556505,"fullName":"Testowy kontrahent","shortName":"KONTRAHENT TESTOWY","locality":"Zielona Góra","countryCode":"PL","tin":"929-185-17-23","regon":"081108705","street":"al.WojskaPolskiego","houseNo":"11","flatNo":"","postCode":"65-077","post":"ZielonaGóra","phone":"+48 68 45 66 900","email":"handelpro@streamsoft.pl","bankAccount":"52 1140 1850 0000 2403 1700 1001","fax":"+48 68 45 66 933","website":"www.streamsoft.pl","note":"Uwagi na temat kontrahenta"}'
Żądanie (JSON):
{
"id": 4556505,
"fullName" : "Testowy kontrahent",
"shortName" : "KONTRAHENT TESTOWY",
"locality" : "Zielona Góra",
"countryCode" : "PL",
"tin" : "929-185-17-23",
"regon" : "081108705",
"street" : "al. Wojska Polskiego",
"houseNo" : "11",
"flatNo" : "",
"postCode" : "65-077",
"post" : "Zielona Góra",
"phone" : "+48 68 45 66 900",
"email" : "handelpro@streamsoft.pl",
"bankAccount" : "52 1140 1850 0000 2403 1700 1001",
"fax" : "+48 68 45 66 933",
"website" : "www.streamsoft.pl",
"note" : "Uwagi na temat kontrahenta"
}
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": 4556505,
"fullName": "Testowy kontrahent",
"shortName": "KONTRAHENT TESTOWY",
"countryCode": "PL",
"locality": "Zielona Góra",
"tin": "929-185-17-23",
"regon": "081108705",
"street": "al. Wojska Polskiego",
"houseNo": "11",
"flatNo": null,
"postCode": "65-077",
"post": "Zielona Góra",
"phone": "+48 68 45 66 900",
"email": "handelpro@streamsoft.pl",
"bankAccount": "52 1140 1850 0000 2403 1700 1001",
"fax": "+48 68 45 66 933",
"website": "www.streamsoft.pl",
"note": "Uwagi na temat kontrahenta"
}
}
https://app.firmino.pl/app/services/rest/api/customers/delete/{id}
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/customers/delete/19284001
Odpowiedź (JSON):
{
"success": true,
"response": "Usunięto kontrahenta."
}
https://app.firmino.pl/app/services/rest/api/customers/gus/{nip}
Przykład CURL:
curl -X POST --user login:haslo https://app.firmino.pl/app/services/rest/api/customers/gus/9291849519
Odpowiedź (JSON):
{
"success": true,
"response": {
"id": null,
"fullName": "STREAMSOFT SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ",
"shortName": "STREAMSOFT",
"countryCode": "PL",
"locality": "Zielona Góra",
"tin": "9291849519",
"regon": "081087825",
"street": "Aleja Wojska Polskiego",
"houseNo": "11",
"flatNo": "",
"postCode": "65-077",
"post": "Zielona Góra",
"phone": "",
"email": "",
"bankAccount": null,
"fax": "",
"website": "",
"note": null
}
}