API za dodjelu vozača

1. Opis

API za dodjeljivanje vozača koristi se za dodjeljivanje vozača objektima (vozilima). To omogućuje web korisnicima koji su generirali svoj API ključ da kreiraju dodjele vozača ili dobiju najnovije dodjele pomoću API poziva.

2. Verzija API-ja 1

2.1. Izradi zadatak
2.1.1. Zahtjev s datumom i vremenom

POST /driver/assignations?version=1&api_key=<...>
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8
 
BODY:
    {
    "driver_id": "240afea1-84ae-43ec-8139-f13cfa2f3094",
    "object_id": "7bf8990c-dba6-11e9-bdfc-1ff21de66015",
    "event_type": "START"
    "datetime":"2021-07-01T08:50:23.893Z"
    }

2.1.2. Zahtjev bez datuma i vremena

POST /driver/assignations?version=1&api_key=<...>
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8
 
BODY:
    {
    "driver_id": "240afea1-84ae-43ec-8139-f13cfa2f3094",
    "object_id": "7bf8990c-dba6-11e9-bdfc-1ff21de66015",
    "event_type": "START"
    }
 ParameterTypeDescriptionIs requiredValidation
1versionstringVersion of API+
2api_keystringUser identification key +
3driver_idstringDriver identifier, External driver ID +
4object_idstringObject identifier, External object ID +
5event_typestringEvent type +Possible values: START, STOP
6datetimestringDatetime for START or STOP event -ISO 8601 datetime

2.1.3. Odgovor na ispravan zahtjev

{
    "object_id":"7bf8990c-dba6-11e9-bdfc-1ff21de66015",
    "driver_id":"240afea1-84ae-43ec-8139-f13cfa2f3094",
    "event_type":"START",
    "datetime":"2021-07-01T08:50:23.893Z"
}
 ParameterTypeDescription
1driver_idstringDriver identifier, External driver ID
2object_idstringObject identifier, External object ID
3event_typestringEvent type
4datetimestringDatetime of START or STOP event

2.1.4. Odgovori za netočan zahtjev

{
    "code": 422,
    "message": "Validation failed, see 'fieldValidationErrors' for more details",
    "field_validation_errors": [
        {
            "field": "objectId",
            "reason": "must not be empty",
            "rejected_value": "<null value>"
        },
        {
            "field": "driverId",
            "reason": "must not be empty",
            "rejected_value": "<null value>"
        },
        {
            "field": "eventType",
            "reason": "must not be null",
            "rejected_value": "<null value>"
        }
    ]
}
{
    "code": 400,
    "message": "Please provide valid driver assignation event type START|STOP"
}
{
    "code": 400,
    "message": "Invalid format: \"1993 05 04\" is malformed at \" 05 04\""
}
{
    "code": 404,
    "message": "Object with id 7bf8990c-dba6-11e9-bdfc-1ff21de66015asdasdasdasdasdadas not found"
}
{
    "code": 404,
    "message": "Driver with id 240afea1-84ae-43ec-8139-f13casfa2f3094 not found"
}
ParameterDescription
codeError code
400 - server cannot or will not process the request due to an apparent client error;
404 - requested resource could not be found but may be available in the future;
messageError code message

2.2. Preuzmi zadnji zadatak
2.2.1. Zahtjev od strane ObjectID-a

GET /driver/assignations/last?version=1&byObjectId={objectId}&api_key=<...>
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8

2.2.2. Primjer byObjectID

GET /driver/assignations/last?version=1&byObjectId=7bf8990c-dba6-11e9-bdfc-1ff21de66015&api_key=L6fwb1xODwA95qF7ybXJ4S2cSM49h1Wj
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8

2.2.3. Zahtjev od strane ID-a vozača

GET /driver/assignations/last?version=1&byDriverId={driverId}&api_key=<...>
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8

2.2.4. Primjer byDriverId

GET /driver/assignations/last?version=1&byDriverId=240afea1-84ae-43ec-8139-f13cfa2f3094&api_key=L6fwb1xODwA95qF7ybXJ4S2cSM49h1Wj
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8

 

 ParameterTypeDescriptionIs requiredValidation
1versionstringVersion of API+
2api_keystringUser identification key+
3byDriverIdstringDriver identifier, External driver ID+Either byDriverId or byObjectId is required
4byObjectIdstringObject identifier, External object ID+Either byDriverId or byObjectId is required

2.2.5. Odgovor na ispravan zahtjev

{
    "object_id":"7bf8990c-dba6-11e9-bdfc-1ff21de66015",
    "driver_id":"240afea1-84ae-43ec-8139-f13cfa2f3094",
    "event_type":"STOP",
    "datetime":"2021-07-01T08:50:28.893Z"
}

 

 ParameterTypeDescription
1driver_idstringDriver identifier, External driver ID
2object_idstringObject identifier, External object ID
3event_typestringEvent type
4datetimestringDatetime of START or STOP event

2.2.6. Odgovori za netočan zahtjev

{
    "code": 400,
    "message": "No query parameters were provided. Provide query parameters byDriverId or byObjectId"
}
{
    "code": 404,
    "message": "Driver assignation event by driver id 8200f935-4970-43e3-8ab2-220c7f6463f4 not found"
}
{
    "code": 404,
    "message": "Driver with id 240afea1-84ae-43ec-8139-f13cfa2f3a094 not found"
}
{
    "code": 404,
    "message": "Object with id 7bf8990c-dba6-11de9-bdfc-1ff21de66015 not found"
}
ParameterDescription
codeError code
400 - server cannot or will not process the request due to an apparent client error;
404 - requested resource could not be found but may be available in the future;
messageError code message