Skip to main content
GET
/
location-histories
Read location history
curl --request GET \
  --url https://apiweb.mile.app/api/v3/location-histories \
  --header 'Authorization: Bearer <token>'
{
  "status": true,
  "message": "Success",
  "tasks": {
    "current_page": 1,
    "data": [
      {
        "email": "example@mile.app",
        "taskId": "634e98098ce69d29474a7e11",
        "speed": 40,
        "distance": 50,
        "duration": 50,
        "lat": -6.1771046,
        "lon": 106.9240199,
        "_id": "634e98098ce07d29474a7e22_example@mile.app_1675224349343",
        "time": 1675224349343,
        "organizationId": "634e98098ce07d29474a7e22",
        "createdTime": "2022-10-07 03:00:58",
        "updatedTime": "2022-10-07 04:00:58"
      },
      {
        "_id": "64a696536d01ea0d503db772",
        "email": "example@mile.app",
        "lat": -6.23239438813826,
        "lon": 106.82152618097032,
        "speed": 0,
        "distance": 0,
        "duration": 0,
        "startTime": "2023-07-06 10:23:00",
        "notes": null,
        "createdTime": "2023-07-06 10:24:19",
        "taskId": "",
        "time": 1688639059872,
        "organizationId": "6488344e8db84c3a511f62b2",
        "finish": {
          "lat": -6.296958793290206,
          "lon": 106.7858189729966,
          "finishTime": "2023-07-06 11:23:00",
          "notes": null,
          "totalDuration": 60,
          "totalDistance": 24
        },
        "updatedTime": "2023-07-06 10:53:36",
        "trackedTime": 60
      }
    ],
    "first_page_url": "http://apiweb.mile.app/api/location-histories?limit=20&fields=email%2CtaskId%2Clon%2Clat&email=example%40mile.app&sortBy=createdTime&sortOrder=desc&page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "http://apiweb.mile.app/api/location-histories?limit=20&fields=email%2CtaskId%2Clon%2Clat&email=example%40mile.app&&sortBy=createdTime&sortOrder=desc&page=1",
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "active": false
      },
      {
        "url": "http://apiweb.mile.app/api/location-histories?limit=20&fields=email%2CtaskId%2Clon%2Clat&email=example%40mile.app&&sortBy=createdTime&sortOrder=desc&page=1",
        "label": "1",
        "active": true
      },
      {
        "url": null,
        "label": "Next &raquo;",
        "active": false
      }
    ],
    "next_page_url": null,
    "path": "http://apiweb.mile.app/api/location-histories",
    "per_page": 20,
    "prev_page_url": null,
    "to": 2,
    "total": 2
  }
}

Authorizations

Authorization
string
header
required

Use a valid Bearer token to authenticate.

Query Parameters

email
string

Worker's email that assigned to the monitored task.

taskId
string

The identifier for the task that generated by system. Use GET /tasks API to get the list of Task IDs. Example: 621dd813eb3ebf16b94d6969

page
integer
default:1

The page number of results to retrieve. Example: 2

limit
integer
default:20

Specifies the maximum number of items to retrieve in a single request. Example: 10

Required range: 1 <= x <= 1000
sortOrder
string

sortOrder is to decide ascending or descending order by createdTime Example: asc or desc. Default: desc

timeBy
string

Optional filter to range data between one of the following options : enum: createdTime,startTime If this parameter is not provided, the timeFrom and timeTo filters will be ignored. Example: createdTime

timeFrom
string

date time selector to select timeBy from. Example: 2023-00-01 00:00:00

timeTo
string

date time selector to select timeBy to. Example: 2023-00-10 00:00:00

startFinish
string

when the value is true the start finish record will be show, if the value is false it only displays the location history record.

isLatest
boolean

when the value is true, it will display the latest location history data from the user, and if the value is false, it will show the older location history data.

fields
string

Fields is for selecting the specific fields that you can choose by multiples to show in the response using a string with a comma delimiter.

eventName
string

A flagging of location history with value otw, nearBy and done. Example: done. Default: null

createdFrom
string

A flagging for describe location history created from, default value generated by system is mileAppField. Example: mileAppField. Default: null

Response

Success

status
boolean

Status of response.

message
string

Message of API response.

tasks
object

Detail of object location history.