If i look at the strava api documentation it appears you can only update the weight of an athlete by which requireds a Float, in the endpoint path instead of the request body.
Are you sending the whole object in the putrequest in the requestbody? Or did you copy paste it under the request instead of response by accident?
From the documentation: you can only update the athlete if you have the profile:write scope on your access token/refresh token. And i think this would be the issue atm, the mendix rest call seems to be fine.
https://developers.strava.com/docs/reference/#api-Athletes-updateLoggedInAthlete
https://developers.strava.com/docs/oauth-updates/
Hey Jannes,
It’s hard to say why your call isn’t working because there's not any info to go on. But here's some stuff you can check.
Does the Rest call action give you an error, and if so what is the error? (check the LatestHttpResponse object which you can access if you set an error handler on the rest call action) .
You might call the wrong endpoint, or the authorization doesn't work. Maybe they need additional headers etc.
If you do get a statuscode 200 in return maybe you can find an answer by setting your ‘Rest Consume’ loglevel to Trace to more easily check the exact request that you sent to the endpoint.
I got 2 log messages for my PUT request:
Request content for PUT request to https://www.strava.com/api/v3/athlete HTTP/1.1
Authorization: (omitted)
{"id":000000,
"username":null,
"resource_state":2,
"firstname":"test",
"lastname":"test",
"city":"someCity",
"state":"test",
"country":"test",
"sex":"M",
"premium":false,
"summit":false,
"created_at":"2019-10-25T09:00:36Z",
"updated_at":"2020-03-05T12:52:20Z",
"badge_type_id":0,
"profile_medium":"avatar/athlete/medium.png",
"profile":"avatar/athlete/large.png",
"friend":null,
"follower":null
}
Response content for PUT request to https://www.strava.com/api/v3/athlete
HTTP/1.1 200 OK
Date: Thu, 05 Mar 2020 14:05:32 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=0, private, must-revalidate
Via: 1.1 linkerd
X-Download-Options: noopen
Status: 200 OK
X-RateLimit-Limit: 600,30000
X-Request-Id: 3c35b741-13ad-4578-9d15-43e2b150f9cc
Referrer-Policy: strict-origin-when-cross-origin
ETag: W/"ba4115aa21e1465434a6ddf3e9aea42f"
X-Frame-Options: SAMEORIGIN,DENY
X-RateLimit-Usage: 5,53
X-Content-Type-Options: nosniff
X-Permitted-Cross-Domain-Policies: none
Vary: Origin
X-XSS-Protection: 1; mode=block
- Looking at the first log-message I guess that I don’t have write access? Which is weird cuz I did put it in the scope.
- Looking at the second message, I do get info back but it is the original (unchanged) data.
Here is more information about how to configure the REST action.
https://docs.mendix.com/refguide/call-rest-action
Make sure the value in the form-data is a variable/value defined in your microflow – example $value – or is a constant.
Can also try setting the log level of the “REST Consume” to Trace, to see what the response of the PUT call is.