Update a user avatar using the API
Hi everyone,
We're adding new avatars to our community and we want to delete the old ones, which will leave us with a lot of broken avatars.
I've been looking here for a solution and I know I can use JavaScript to catch those broken images and replace them at runtime. The problem is this doesn't resolve the problem (users having a broken avatar), in fact, it hides it and there's no way for users to know if they have a valid avatar or not.
We're considering using the API to modify each user profile using a non-custom avatar to replace it with a default avatar, but I can't find anything on the documentation. API v1 doesn't have a call for that, in fact, the documentation says that we have to use API v2 for that. But apparently, endpoints are not allowed to make HTTP calls to any .lithium.com domains.
Is building a mini-app on a different server, going through the authorization process and make the call the only way to update another user's avatar? Am I missing something?
Thanks!
We had an issue where users' avatars, especially if they had used external ones at some point, where missing and it looked horrendous.
I added a one-click button for admins and mods on the profile page that will pick randomly from our set of uploaded avatars.
Long story short, API 1 works just fine for this. The frontend button, on click, pulls from an array of options, then sends the randomly selected one to an endpoint.
Our endpoint simply does the below. As you can tell from the end it's just set to pick from a certain folder in our assets/avatars section:
<#assign result = restadmin("/users/id/${user_id}/profiles/name/url_icon/set?value=avatar:candy/Spotify_New/${user_avatar}")/>