API - Kilometrówka

Punkt dostępowy

Punkt dostępowy znajduje się pod adresem: https://app.firmino.pl/app/services/rest/api/mileage/

Metody

  • add – dodawanie nowego wpisu
  • get – pobieranie danych wpisu
  • find – pobieranie listy wpisów
  • update – aktualizowanie danych wpisu (wymagany id)
  • delete – usuwanie wpisu (wymagany id)

Pola

ParametrOpisUwagiTyp danych
idIdentyfikatorbraklong
dateData wyjazdubrakstring(yyyy-mm-dd)
driverKierowcabrakstring
destinationCel wyjazdubrakstring
distanceDystansbrakdecimal
rateStawka za kilometr(domyślnie 0.8358)Niewymaganydecimal
notes NotatkaNiewymaganystring
id (car)ID pojazdubraklong
name (car) Nazwa pojazduTylko do odczytustring
registration (car)Rejestracja pojazduTylko do odczytustring

Przykładowe zapytania

https://app.firmino.pl/app/services/rest/api/mileage/add

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/mileage/add -d '{"date": "2022-12-07",
        "driver": "Kierowca testowy",
        "destination": "Delegacja",
        "distance": "23.00",
        "car": {"id": 1811}
}'

Żądanie (JSON):

{
        "car": {
            "id": 1811
        },
        "date": "2022-12-07",
        "driver": "Kierowca testowy",
        "destination": "Delegacja",
        "distance": "23.00"
}

Odpowiedź (JSON):

{
    "success": true,
    "response": {
        "id": 1482,
        "car": {
            "id": 1811,
            "registration": "DLU 22222",
            "name": "Pojazd1 (DLU 22222)"
        },
        "date": "2022-12-07",
        "driver": "Kierowca testowy",
        "destination": "Delegacja",
        "distance": "23.00",
        "rate": "0.8358",
        "notes": null
    }
}

https://app.firmino.pl/app/services/rest/api/mileage/add

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/mileage/add -d '{"date": "2022-12-07",
        "driver": "Kierowca testowy",
        "destination": "Delegacja",
        "distance": "23.00",
        "rate": "0.343",
        "notes": "notatka do wpisu",
        "car": {"id": 1811}
}'

Żądanie (JSON):

{
        "car": {
            "id": 1811
        },
        "date": "2022-12-07",
        "driver": "Kierowca testowy",
        "destination": "Delegacja",
        "distance": "23.00",
        "rate": "0.343",
        "notes": "notatka do wpisu"
}

Odpowiedź (JSON):

{
    "success": true,
    "response": {
        "id": 1483,
        "car": {
            "id": 1811,
            "registration": "DLU 22222",
            "name": "Pojazd1 (DLU 22222)"
        },
        "date": "2022-12-07",
        "driver": "Kierowca testowy",
        "destination": "Delegacja",
        "distance": "23.00",
        "rate": "0.343",
        "notes": "notatka do wpisu"
    }
}

https://app.firmino.pl/app/services/rest/api/mileage/get/1486

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/mileage/get/1632

Odpowiedź (JSON):

{
    "success": true,
    "response": {
        "id": 1483,
        "car": {
            "id": 1811,
            "registration": "DLU 22222",
            "name": "Pojazd1 (DLU 22222)"
        },
        "date": "2022-12-07",
        "driver": "Kierowca testowy",
        "destination": "Delegacja",
        "distance": "23.00",
        "rate": "0.3430",
        "notes": "notatka do wpisu"
    }
}

https://app.firmino.pl/app/services/rest/api/mileage/find

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/mileage/find -d '{}'

Odpowiedź (JSON):

{
    "success": true,
    "response": {
        "params": {
            "total": 2,
            "page": 1,
            "size": 15,
            "sortField": null,
            "sortOrder": null,
            "text": null,
            "filters": null
        },
        "list": [
            {
                "id": 1583,
                "car": {
                    "id": 1811,
                    "registration": "DLU 11111",
                    "name": "Pojazd1 (DLU 11111)"
                },
                "date": "2022-22-03",
                "driver": "Kierowca testowy",
                "destination": "Delegacja",
                "distance": "23.00"
            },
            {
                "id": 1582,
                "car": {
                    "id": 1811,
                    "registration": "DLU 22222",
                    "name": "Pojazd2 (DLU 22222)"
                },
                "date": "2022-04-07",
                "driver": "Kierowca testowy",
                "destination": "Delegacja",
                "distance": "23.00"
            }
}

https://app.firmino.pl/app/services/rest/api/mileage/find

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/mileage/find -d '{"page":1,"size":10,"text":"","filters":[{"name":"driver","value":"Kierowca1"}]}'

Żądanie (JSON):

{
    "page" : 1,
    "size" : 2,
    "text" : "",
    "filters":
        [ 
            {
                "name": "driver",
                "value": "Kierowca1"
            }
        ]
}

Odpowiedź (JSON):

{
    "success": true,
    "response": {
        "params": {
            "total": 23,
            "page": 1,
            "size": 2,
            "sortField": null,
            "sortOrder": null,
            "text": "",
            "filters": [
                {
                    "name": "driver",
                    "value": "Kierowca1"
                }
            ]
        },
        "list": [
            {
                "id": 1280,
                "car": {
                    "id": 1730,
                    "registration": "DLU 11111",
                    "name": "Testowy2 (DLU 11111)"
                },
                "date": "2019-10-13",
                "driver": "Kierowca1",
                "destination": "Delegacja",
                "distance": "47.00"
            },
            {
                "id": 1245,
                "car": {
                    "id": 1730,
                    "registration": "DLU 11111",
                    "name": "Testowy2 (DLU 11111)"
                },
                "date": "2022-10-13",
                "driver": "Kierowca1",
                "destination": "Delegacja",
                "distance": "47.00"
            }
        ]
    }
}

https://app.firmino.pl/app/services/rest/api/mileage/update

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/mileage/update -d '{"date": "2022-11-11",
        "driver": "Kierowca edytowany",
        "destination": "Delegacja",
        "distance": "87.00",
        "car": {"id": 1811}
}'

Żądanie (JSON):

{
        "id": 1245,
        "car": {
            "id": 1811
        },
        "date": "2022-11-11",
        "driver": "Kierowca edytowany",
        "destination": "Delegacja",
        "distance": "87.00"
}

Odpowiedź (JSON)

{
    "success": true,
    "response": {
        "id": 1245,
        "car": {
            "id": 1811,
            "registration": "DLU 22222",
            "name": "Pojazd1 (DLU 22222)"
        },
        "date": "2022-11-11",
        "driver": "Kierowca edytowany",
        "destination": "Delegacja",
        "distance": "87.00",
        "rate": "0.8358",
        "notes": null
    }
}

https://app.firmino.pl/app/services/rest/api/mileage/delete/1245

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/mileage/delete/1245

Odpowiedź (JSON):

{
    "success": true,
    "response": "Usunięto wpis"
}