Hello everyone, if you, like me have been trying to upload a new profile picture to your Arduino account and have faced the error "FAILED TO UPLOAD AVATAR" you will be glad to know that there is a solution/workaround.
For the ones that just want the solution: Set a URL, even if it is a random one as long as it meets has https://{domain}.{tdl} put https://google.com if you want. When you save it, you will be able to upload your image properly.
Now, to the developers of the Arduino website, here is the reasoning behind the bug/design.
When trying to upload an image without a website set in your profile you get the following response:
PUT https://api2.arduino.cc/users/v1/users/byID/me/public 400 (Bad Request)
{
"name": "BadRequest",
"id": {requestID},
"message": "the given website url is not valid",
"temporary": false,
"timeout": false,
"fault": false
}
So I took a look into the payload sent to the PUT request and there it was the payload did not have the website property set and therefore the request was being returned as a bad request.
{
"avatar": "https://content.arduino.cc/avatars/3/thefallender.png",
"bio": "Sup",
"website": "",
"avatar_data": {longStringOfImageData}
}
I would also like to note that the PUT request for removing the website URL gets the same response, forbidding the user from removing the URL from their profile, so with this workaround a lot of people will have random urls set in their profile without being able to remove them.
Happy coding.
Edit1: Thanks to the moderator that unmarked the post as spam.
Edit2: I do not know if it linking this post to other posts with the same issue would be an issue. For now I will refrain from doing that as it could be flagged as spam.