Skip to content
Tharindu Prabhath Ranathunga edited this page Mar 18, 2015 · 7 revisions

Tracker data

GET /api/tracker/

Lists the details of all trackers

GET api/tracker/:id/

{ idTracker - Id of the tracker which the details are needed }

Send the details of a tracker

POST /api/tracker/create

Inserts details of a tracker

Sample payload for Insert

#!JavaScript

{
	"id": "TRK456789",
	"status": 1,
	"device" : {
		"mac": "1gy6th78t8787tb87tb87"
	}
}

POST /api/tracker/:idTracker/update

{ idTracker - Id of the tracker which to be updated }

Update the details of a tracker

Sample payload for update

#!JavaScript

{
	"status": 0,
	"device" : {
		"mac": "1gy6th78t8787tb87tb87"
	}
}

GET /api/tracker/:idTracker/delete

{ idTracker - Id of the tracker which to be deleted }

Mark the given tracker an Inactive

GET api/tracker/locations

Send the current position of all the trackers

eg:

#!JavaScript

[
    {
        "_id": "TRK456790",
        "timestamp": "2015-02-03T09:18:02.989Z",
        "status": 1,
        "path": [
            {
                "timestamp": 51422955082989,
                "speed": 30,
                "direction": 45.510029,
                "longitude": 86.510029,
                "latitude": 8.675009
            }
        ]
    },
    {
        "_id": "TRK456799",
        "timestamp": "2015-02-03T09:18:02.989Z",
        "status": 1,
        "path": [
            {
                "timestamp": 51422955082989,
                "speed": 30,
                "direction": 45.510029,
                "longitude": 81.510029,
                "latitude": 8.675009
            }
        ]
    }
]

GET api/tracker/:id/location

{ id - Id of the tracker which the location is needed }

Send the current position of a tracker

GET api/tracker/locations/initial

Send the current path and the tracker details of all the tracker since the starting mark

Tracker data

GET api/tracker/location/data

Send all the tracker location data pushed to the server

POST api/tracker/location/data

Saves the sent location data as POST payload. Expects a JSON.

eg:

#!JavaScript

{
	"id": "TRK456789",
	"status": 1,
	"timestamp": 1422955082989,
	"data": [
		{
			"latitude": 8.675009, 
			"longitude": 81.510029, 
			"direction": 45.510029,
			"speed" : 30.00,
			"timestamp": 1422955082989
		}, … //	More locations data objects
          ]
}

Save & Import the following collection to Postman REST client. postman collection

Clone this wiki locally