fraizman
Neuling
Posts: 18
Joined: Sat 31. Oct 2020, 09:02

API : TypeError: NetworkError when attempting to fetch resource.

Mon 8. Feb 2021, 09:27

Hello,
i'm testing the /api/v1/metrics/bodyComposition to upload my weight (older data).
I use (i replace the example token with my personal one) in the request body at https://runalyze.com/doc/personal :
curl -s --location --request POST 'https://runalyze.com/api/v1/metrics/bodyComposition' --header 'token: '5cf803010f01c0b2a75b35c7e86ad68b
{
"date_time": "2021-02-08T12:00:00Z",
"weight": 80,
"fat_percentage": 20,
"water_percentage": 60,
"muscle_percentage": 40,
"bone_percentage": 15
}
Then, i click execute and the "Server response" is "TypeError: NetworkError when attempting to fetch resource."
Could you please help me ?
fraizman
0 x

User avatar
mipapo
Administrator
Posts: 1283
Joined: Mon 29. Jul 2013, 20:26
Location: Kiel
Contact: Website Facebook Twitter

Re: API : TypeError: NetworkError when attempting to fetch resource.

Mon 8. Feb 2021, 09:51

Don't see a problem. I think your curl request is a bit wrong:
Example:

Code: Select all

curl --location --request POST 'https://runalyze.com/api/v1/metrics/bodyComposition' \
--header 'token: xxxxxxx' \
--data-raw '{
  "date_time": "2021-02-08T15:00:00Z",
  "weight": 80,
  "fat_percentage": 20,
  "water_percentage": 60,
  "muscle_percentage": 40,
  "bone_percentage": 12
}'
0 x
###Become a Runalyze supporter###
- Nutzerhilfe/User help -

Run Happy!,
Michael
P.S. Ich antworte gerne kurz und knackig ;)
Image

fraizman
Neuling
Posts: 18
Joined: Sat 31. Oct 2020, 09:02

Re: API : TypeError: NetworkError when attempting to fetch resource.

Mon 8. Feb 2021, 10:11

Hello mipapo and thanks for your help ;) .

I test your code and the responses are :
curl -X POST "https://runalyze.com/api/v1/metrics/bodyComposition" -H "accept: */*" -H "Content-Type: application/json" -d "curl --location --request POST 'https://runalyze.com/api/v1/metrics/bodyComposition' \\ --header 'token: xxx' \\ --data-raw '{ \"date_time\": \"2021-02-08T10:00:00Z\", \"weight\": 80, \"fat_percentage\": 20, \"water_percentage\": 60, \"muscle_percentage\": 40, \"bone_percentage\": 12 }'"
and
TypeError: NetworkError when attempting to fetch resource.
0 x

User avatar
mipapo
Administrator
Posts: 1283
Joined: Mon 29. Jul 2013, 20:26
Location: Kiel
Contact: Website Facebook Twitter

Re: API : TypeError: NetworkError when attempting to fetch resource.

Mon 8. Feb 2021, 10:39

Now your curl requests looks totally wrong:
Correct one:

Code: Select all

curl --location --request POST 'https://runalyze.com/api/v1/metrics/bodyComposition' --header 'token: xxxxx' --data-raw '{ "date_time": "2021-02-08T10:00:00Z", "weight": 80, "fat_percentage": 20, "water_percentage": 60, "muscle_percentage": 40, "bone_percentage": 12 }'
0 x
###Become a Runalyze supporter###
- Nutzerhilfe/User help -

Run Happy!,
Michael
P.S. Ich antworte gerne kurz und knackig ;)
Image

fraizman
Neuling
Posts: 18
Joined: Sat 31. Oct 2020, 09:02

Re: API : TypeError: NetworkError when attempting to fetch resource.

Mon 8. Feb 2021, 17:29

It's okay now with a script shell (local .sh) :idea: but not at https://runalyze.com/doc/personal.
Many thanks mipapo :D
0 x

User avatar
mipapo
Administrator
Posts: 1283
Joined: Mon 29. Jul 2013, 20:26
Location: Kiel
Contact: Website Facebook Twitter

Re: API : TypeError: NetworkError when attempting to fetch resource.

Mon 8. Feb 2021, 17:53

fraizman wrote:
Mon 8. Feb 2021, 17:29
It's okay now with a script shell (local .sh) :idea: but not at https://runalyze.com/doc/personal.
Many thanks mipapo :D
I don't know what you mean. "try out" at that page is not working and that's okay
0 x
###Become a Runalyze supporter###
- Nutzerhilfe/User help -

Run Happy!,
Michael
P.S. Ich antworte gerne kurz und knackig ;)
Image

fraizman
Neuling
Posts: 18
Joined: Sat 31. Oct 2020, 09:02

Re: API : TypeError: NetworkError when attempting to fetch resource.

Fri 12. Feb 2021, 19:35

It was a typical PEBMAC ("problem exists between monitor and chair") :mrgreen:
The code is okay and the little sh script enables me to upload my older weight data
0 x

Return to “Personal API”

Who is online

Users browsing this forum: No registered users and 1 guest