You should use a URL like this instead:
http://host/api/users/1
Thank you. That worked for me.
To fetch a single user using the Traccar Users API, you can make a GET request to the /api/users/{id}
endpoint, where {id}
is the ID of the user you want to fetch. Here's an example of how you can do this using cURL:
curl -X GET \
http://localhost:8082/api/users/1 \
-H 'Accept: application/json' \
-H 'Authorization: Basic YWRtaW46YWRtaW4='
In this example, we're fetching the user with ID 1. You'll need to replace http://localhost:8082
with the URL of your Traccar server, and YWRtaW46YWRtaW4=
with your own base64-encoded credentials.
Hi, I am trying to fetch a specific user from traccar using the "users" API endpoint. It requires a parameter userId, however when I pass in the userId I get an empty array result.
Here is my code
import requests url = "http://host/api/users?userId=1" payload={} headers = { 'Authorization': 'Basic XXXXXXXX' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text)
What could I be possibly doing wrong? The authentication credentials have administrator privileges.