SamR1/FitTrackee

Documentation issue in terms of API access

Closed this issue · 2 comments

fr567 commented

Hi all,

in my opinion, but maybe I missed something, it is not 100% clear for me, if I can do the following.

I'm currently trying to create a sensor in home assistant via a RESTful integration, so the km I walked, run, etc. are shown in my home assistant dashboard. For me it is not clear how I can get a token to authorize at the Fittrackee API.

I tried to get a token via POST /api/auth/login, but I always get the response 400 Bad Request. To test this I use Postman with the following code:

curl --location --request POST 'http://192.168.XXX.XX:5000/api/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "xxx@xxx.net",
    "password": "yyy"
}'

It is also not clear for me, if this is possible at all, because in the documentation is written, that this is only possible for first party application, but in #144 it seems, that it is possible.

THX very much. I would also be interesten in a kind of support link for this great project :-).

fr567 commented

Short update. Now I get the an answer. I forgot to activate Content-Length in the Headers.

fr567 commented

Another update, maybe it helps someone. Now it is working. I get a auth_token via the above POST command, if Content-Length is activated.

With this auth_token I can then get data from FitTrackee via the following command:


curl --location --request GET 'http://192.168.178.68:5000/api/stats/duncan/by_time?from=2018-01-01&time=year&to=2023-06-30' \
--header 'Authorization: Bearer $Gathered_auth_token'