Are there any errors on the status screen? If not, you should be able to see location. If you don't, possibly WebSockets are blocked on your network.
Make sure you are logged in before calling the API. Also check response code, not just content.
Thanks for your prompt response :)
Here are the request/response for GET positions (I've masked out the email and password in the Cookie)
General
Request URL:http://demo4.traccar.org/api/positions
Request Method:GET
Status Code:200 OK
Remote Address:104.251.215.88:80
Response Headers
view source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:origin, content-type, accept, authorization
Access-Control-Allow-Methods:GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin:*
Content-Length:2
Content-Type:application/json
Date:Thu, 09 Feb 2017 21:03:39 GMT
Server:Jetty(9.2.19.v20160908)
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,ar;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Cookie:JSESSIONID=o6rcsoqhuw562xdeezxmoswj; user=MyEmail; password=MyPassword; _ga=GA1.2.793192332.1486663519
Host:demo4.traccar.org
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
You have to use "application/json" in the "Accept" header.
How can I do that in Google Chrome? I'm just trying to make sure I can at least find the location using a browser (Either GUI based or API based) before I start my coding.
Also, without that header I'm getting a proper and full response to devices. Does that only affect positions?
Thanks again
It affects positions only because positions API can return data in multiple formats. You can use some Chrome extension to send requests with custom headers.
Thanks for the tip, but it didn't help much :(
I installed ModHeader and set it up to inject Accept with value of application/json but the response was the same empty list
General
Request URL:http://demo4.traccar.org/api/positions
Request Method:GET
Status Code:200 OK
Remote Address:104.251.215.88:80
Response Headers
view source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:origin, content-type, accept, authorization
Access-Control-Allow-Methods:GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin:*
Content-Length:2
Content-Type:application/json
Date:Thu, 09 Feb 2017 21:45:19 GMT
Server:Jetty(9.2.19.v20160908)
Request Headers
view source
Accept:application/json
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,ar;q=0.6
Authorization:Basic c2hlcmlmLmZhbm91c0BnbWFpbC5jb206QUM1ZW1jVVQ1eipHOVBNJQ==
Cache-Control:max-age=0
Connection:keep-alive
Cookie:JSESSIONID=o6rcsoqhuw562xdeezxmoswj; user=MyEmail; password=MyPassword; _ga=GA1.2.793192332.1486663519; _gat=1
Host:demo4.traccar.org
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Just to confirm the value of "Device identifier" in Traccar Client must match the value of "Identifier" when creating the device right?
I'll try to install Traccar Server at home later tonight and setup port forwarding and see if this helps. If not, I can give you the "Device identifier" for you to check if something is wrong from my side.
Thanks again for your help. Much appreciated.
Empty list means there is no data for your device(s). I guess the app doesn't send to your server.
Yes, device id must match the id in the app.
Hi there,
I am working on a small personal project with the objective of being able to automatically change the active program on my smart thermostat depending on the location of both my phone and my wife's phone. (e.g. If either phone is at home then the Home profile should be active. If both are not home then the Away profile should be active.)
My thermostat is an ecobee Smart Si, and I'm able to automatically interact with it using the ecobee API. I have written a Python program that is able to do everything I want it to do except figure out the location of our phones from within Python.
So, I was doing some research on a GPS tracking service with an API and came across Traccar. I have downloaded Traccar Client on my phone and set it up against demo4 server, with a Device identifier set to a 16 digit randomly generated string and an update interval of 900 seconds.
I have a few questions that I'd like some help with please
I will look further into this, and potentially also install Traccar Server on one of my PCs at home, but any help from the community would be appreciated.
Thanks in advance