Closed feuerwasser85 closed 1 year ago
Thanks, I'll take a look on the weekend
Sorry, made a typo. It seems that Tractive now uses /4 for its API path. If i can provide any more info let me know. Also if you describe how you reverse ingineered the API maybe i can help. Not very good with wireshark (yet)
I did use anything but Firefox dev tools and their website😀
I can't reproduce it, all V3 apis seem to work to me, I successfully get all the mentioned data
Strange. When i try to get a bearer with the following curl command, it works:
#!/bin/sh
time_from=$(date -d '6 hours ago' "+%s")
now=$(date +"%s")
bearer=$( curl -s -X "POST" "https://graph.tractive.com/3/auth/token" \
-H 'Content-Type: application/json' \
-H 'X-Tractive-Client: NUMBERSOVERNUMBERS' \
-d $'{
"platform_email": "some_email@mail.com",
"platform_token": "PASSWORD",
"grant_type": "tractive"
}' | jq -r ".access_token" )
echo $bearer
Wlg4-W1a8BZlIPlobmCZUZeSwxzDT0VOUE7mK2wDqxEsNvD7sy20ctHSQ72qeymhMGWusM4AnoLjdmvyYVTg8AQ4FAfYKBGviJG_kgrgi4JjLaY= When i try to use that bearer in a following command in the same script i get a 500 server error.
hw_report=$( curl -s --location --request GET "https://graph.tractive.com/3/device_hw_report/TRACKERID/" \
-H 'X-Tractive-Client: NUMBERSOVERNUMBERS' \
-H 'content-type: "application/json;charset=UTF-8' \
-H 'accept: "application/json, text/plain, */*' \
-H 'x-tractive-user: SOMERANDOMNUMBER' \
-H 'authorization: f"Bearer '$bearer )
echo $hw_report
500 Internal Server Error If you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong.
I use this script to check if the API works:
import asyncio
from aiotractive import Tractive
async def main():
async with Tractive("email", "password") as client:
print(await client.authenticate())
for tracker in await client.trackers():
print(tracker)
print(await tracker.hw_info())
print(await tracker.pos_report())
if __name__ == "__main__":
asyncio.run(main())
It does not raise any errors and successfully prints all the data
Now i got it working again. My headers were wrong suddenly. Maybe it was a change in the API or in curl. Before:
hw_report=$( curl -s --location --request GET "https://graph.tractive.com/3/device_hw_report/TRACKERID/" \
-H 'X-Tractive-Client: NUMBERSOVERNUMBERS' \
-H 'content-type: "application/json;charset=UTF-8' \
-H 'accept: "application/json, text/plain, */*' \
-H 'x-tractive-user: SOMERANDOMNUMBER' \
-H 'authorization: f"Bearer '$bearer )
echo $hw_report
After:
hw_report=$( curl -s --location --request GET "https://graph.tractive.com/3/device_hw_report/TRACKERID/" \
-H 'accept: "application/json, text/plain, */*' \
-H 'X-Tractive-Client: NUMBERSOVERNUMBERS' \
-H 'x-tractive-user: SOMERANDOMNUMBER' \
-H 'authorization: f"Bearer '$bearer )
echo $hw_report
The paths /3/device_hw_report/ and /3/tracker//positions don't exist anymore as it seems.