API - Pojazdy
Punkt dostępowy
Punkt dostępowy znajduje się pod adresem: https://app.firmino.pl/app/services/rest/api/cars/
Metody
- add – dodawanie nowego pojazdu
- get – pobieranie danych pojazdu (wymagany id)
- find – pobieranie listy pojazdów
- update – aktualizowanie danych pojazdu (wymagany id)
- delete – usuwanie pojazdu (wymagany id)
Pola
Parametr | Opis | Uwagi | Typ danych |
---|---|---|---|
id | Identyfikator | brak | long |
name | Nazwa pojazdu | brak | string |
registration | Rejestracja pojazdu | brak | string |
value | Wartość pojazdu | brak | decimal |
type | Typ pojazdu (domyślne car) | brak | string |
property | Własność (domyślnie prywatny) | Niewymagany | string |
destiny | Przeznaczenie pojazdu (domyślnie wyłącznie działalność) | Niewymagany | string |
dostępne typy pojazdów:
- car – samochód osobowy
- truck – samochód ciężarowy
- motorcycle – motocykl
dostępne przeznaczenia pojazdów:
- business – wyłącznie działalność
- both – działalność i prywatnie
dostępne własności pojazdów:
- private – prywatny
- leasing – leasing
- hire – najem
- business – służbowy
Przykładowe zapytania
https://app.firmino.pl/app/services/rest/api/cars/add
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/car/add -d '{"name": "Pojazd1", "value": "250000", "registration": "DLU 11111"}'
Żądanie (JSON):
{ "name" : "Pojazd1", "value" : "250000", "registration" : "DLU 11111" }
Odpowiedź (JSON):
{ "success": true, "response": { "id": 1650, "registration": "DLU 11111", "value": "250000", "name": "Pojazd1", "property": "leasing", "destiny": "business", "type": "car" } }
https://app.firmino.pl/app/services/rest/api/cars/add
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cars/add -d '{"name": "Pojazd1", "value": "250000", "registration": "DLU 11111", "property": "leasing", "destiny": "business", "type": "car"}'
Żądanie (JSON):
{ "value" : "250000", "registration" : "DLU 11111", "property" : "leasing", "destiny" : "business", "type" : "car", "name" : "Pojazd1" }
Odpowiedź (JSON):
{ "success": true, "response": { "id": 1720, "registration": "DLU 11111", "value": "250000", "name": "Pojazd1", "property": "leasing", "destiny": "business", "type": "car" } }
https://app.firmino.pl/app/services/rest/api/cars/get/1632
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cars/get/1632
Odpowiedź (JSON):
{ "success": true, "response": { "id": 1632, "registration": "DLU 11111", "value": "250000.00", "name": "Pojazd1", "property": "leasing", "destiny": "business", "type": "car" } }
https://app.firmino.pl/app/services/rest/api/cars/find
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cars/find -d '{}'
Odpowiedź (JSON):
{ "success": true, "response": { "params": { "total": 1, "page": 1, "size": 15, "sortField": null, "sortOrder": null, "text": null, "filters": null }, "list": [ { "id": 1720, "registration": "DLU 11111", "carValue": "250000.00", "name": "Pojazd1", "carProperty": "leasing", "carDestiny": "business", "carType": "car" } ] } }
https://app.firmino.pl/app/services/rest/api/cars/find
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cars/find -d '{"page":1,"size":10,"text":"","filters":[{"name":"type","value":"truck"}]}'
Żądanie (JSON):
{ "page" : 1, "size" : 2, "text" : "", "filters": [ { "name": "type", "value": "truck" } ] }
Odpowiedź (JSON):
{ "success": true, "response": { "params": { "total": 4, "page": 1, "size": 2, "sortField": null, "sortOrder": null, "text": "", "filters": [ { "name": "type", "value": "truck" } ] }, "list": [ { "id": 1637, "registration": "DLU TEST7", "carValue": "37.01", "name": "Testowy8", "carProperty": "hire", "carDestiny": "business", "carType": "truck" }, { "id": 1635, "registration": "DLU TEST1", "carValue": "250000.00", "name": "Pojazd1", "carProperty": "leasing", "carDestiny": "business", "carType": "truck" } ] } }
https://app.firmino.pl/app/services/rest/api/cars/update
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cars/update -d '{"id":1632,"value":"250000","registration":"DLU 11111", "property":"hire", "destiny":"business","type":"car","name": "Pojazd1"}'
Żądanie (JSON):
{ "id" : 1632, "value" : "250000", "registration" : "DLU 11111", "property" : "hire", "destiny" : "business", "type" : "car", "name" : "Pojazd1" }
Odpowiedź (JSON):
{ "success": true, "response": { "id": 1632, "registration": "DLU 11111", "value": "250000", "name": "Pojazd1", "property": "leasing", "destiny": "business", "type": "car" } }
https://app.firmino.pl/app/services/rest/api/cars/delete/1632
Przykład CURL:
curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cars/delete/1632
Odpowiedź (JSON)
{ "success": true, "response": "Usunięto pojazd" }