There is a simplified version of RESTful API, which can be accessed by third-party applications. Current implementation may differ from an ordinary RESTful API. But it works for sure in mobile version of traccar web UI.
So I will describe core concepts here.
1) Prefix for all method calls is in /traccar/rest
2) API exposes all methods from DataService interface Each method is available by URL, for example login method is available at /traccar/rest/login URL
3) Both POST and GET methods are supported.
For POST requests body should contain method arguments serialised in JSON array. For example, login method accepts user and password parameters, so to authenticate the following parameters must be provided within request body:
[“your_username”,”your_password”]
For GET requests JSON array must be provided as payload parameter. For example: /traccar/rest/login?payload=[“your_username”,”your_password”]
4) Errors are returned as HTTP status codes. Status code 200 means that request completed successfully, any different code means that it failed.
5) Method call results are serialised in JSON.
6) Most of method calls require authentication. For now authentication data is stored in HTTP session, so prior to any method call the login method must be invoked.
Hope this helps you get started. Feel free to ask me questions.
Examples with cURL
Authentication info is held in HTTP session, so you should have corresponding cookie in every request after logging in. Below are examples of logging in an fetching data with curl (with demo site at https://d.traccar.litvak.su).
Login (login method)
Note Set-Cookie header with JSESSIONID. This should be put in all next requests.
Load list of devices (getDevices method)
Take full JSON of device and put it to getPositions method.
Load archived positions (getPositions method)
In this concrete example there are no positions in reply.