Get single worker
Basic worker duty event, traveled distance (meters) and time analytics are optionally available by specifying the query parameter analytics
as true
.
You may also provide both from
and to
timestamps as query parameters (up to a maximum duration of 24 hours) to target a specific time range. If you omit these parameters, the worker analytics for the last week will be provided.
Query parameters
Name | Type | Description |
---|---|---|
filter | string array | Optional. A comma-separated list of fields to return, if all are not desired. For example, [ name, location ] . |
curl -X GET "https://onfleet.com/api/v2/workers/1LjhGUWdxFbvdsTAAXs0TFos?analytics=true" \
-u "cd3b3de84cc1ee040bf06512d233719c:"
$ curl -X GET "https://onfleet.com/api/v2/workers/1LjhGUWdxFbvdsTAAXs0TFos" \
-u "cd3b3de84cc1ee040bf06512d233719c:"
onfleet.workers.get(id="1LjhGUWdxFbvdsTAAXs0TFos", queryParams={"analytics": True})
onfleet.workers.get("1LjhGUWdxFbvdsTAAXs0TFos", {"analytics": true});
$onfleet->workers->get("1LjhGUWdxFbvdsTAAXs0TFos", ["analytics"=> true]);
{
"id": "1LjhGUWdxFbvdsTAAXs0TFos",
"timeCreated": 1455049755000,
"timeLastModified": 1455072352267,
"organization": "yAM*fDkztrT3gUcz9mNDgNOL",
"name": "Yevgeny",
"phone": "+14155552299",
"activeTask": null,
"tasks": [
"*0tnJcly~vSI~9uHz*ICHXTw",
"PauBfRH8gQCjtMLaPe97G8Jf"
],
"onDuty": true,
"timeLastSeen": 1455156649007,
"delayTime": null,
"teams": [
"9dyuPqHt6kDK5JKHFhE0xihh",
"yKpCnWprM1Rvp3NGGlVa5TMa",
"fwflFNVvrK~4t0m5hKFIxBUl"
],
"metadata": [],
"location": [
-122.4016366,
37.7764098
],
"vehicle": {
"id": "ArBoHNxS4B76AiBKoIawY9OS",
"type": "CAR",
"description": "Lada Niva",
"licensePlate": "23KJ129",
"color": "Red"
},
"analytics": {
"events": [
{
"action": "onduty",
"time": 1455072352164
},
{
"action": "offduty",
"time": 1455072485603
}
],
"distances": {
"enroute": 0,
"idle": 0
},
"times": {
"enroute": 0,
"idle": 132.18
},
"taskCounts": {
"succeeded": 0,
"failed": 0
}
}
}
{
"id": "1LjhGUWdxFbvdsTAAXs0TFos",
"timeCreated": 1455049755000,
"timeLastModified": 1455072352267,
"organization": "yAM*fDkztrT3gUcz9mNDgNOL",
"name": "Yevgeny",
"phone": "+14155552299",
"activeTask": null,
"tasks": [
"*0tnJcly~vSI~9uHz*ICHXTw",
"PauBfRH8gQCjtMLaPe97G8Jf"
],
"onDuty": true,
"timeLastSeen": 1455156649007,
"delayTime": null,
"teams": [
"9dyuPqHt6kDK5JKHFhE0xihh",
"yKpCnWprM1Rvp3NGGlVa5TMa",
"fwflFNVvrK~4t0m5hKFIxBUl"
],
"metadata": [],
"location": [
-122.4016366,
37.7764098
],
"vehicle": {
"id": "ArBoHNxS4B76AiBKoIawY9OS",
"type": "CAR",
"description": "Lada Niva",
"licensePlate": "23KJ129",
"color": "Red"
}
}
The analytics
query parameter being set to true
will result in a more detailed response.