Update Avatar URL for a user through Automation

Hello,

We have a requirement to update user's Avatar through automation job. Can anyone suggest how we can achieve this?

Thanks

Parents Reply Children
  • My mistake, you are correct there are REST endpoints for setting and updating the avatar.  Those can be called from within an automation.  

  • I'd be interested in seeing a full example of how to do this within an Automation.

    The REST API for this look geared towards a user uploading an image using the browser, and the documentation for Group Avatars and User Avatars doesn't give you info on what you'd need to pass in for FileUploadContext when you're doing this programmatically.

    In an example, I'd really like to see it updating a Group/User avatar using the URL of an image elsewhere on the web via an automation script. That'd be really useful & would help a lot of people trying to figure this out.

  • There is a core_v2_http Script API  widget API that will assist with making a REST Request.  

    If Remote Avatars are allowed for users, you should be able to just directly set the AvatarUrl to the remote Url.

    If remote Avatars are not allowed, or for group Avatars (which don't support setting the Url), you would need to use the Upload options when setting the avatar.  Upload the file to temporary storage and use FileUploadContext or Get the file in Byte[] format and use FileData parameter.

  • I have also filed a bug to have Group and User Avatar API calls added to the Velocity APIs.  That is another option as well, to create a custom velocity API that calls the In process APis and use that in your automation.  That is what the bug will fix, in the mean time you could use your custom velocity calls.  That would make it easier than using a REST call.

    TE-17609: User Avatar and Group Avatar only have REST API Endpoint available, they should be added to the Widget APIs as well

    Completed for 13.0

  • We are able to update the avatar url for a user in the Widget Script. But inside automation, the avatar url is not getting updated using core_v2_http Script API. (Remote Avatars are allowed for users)

    We are using below automation code in Javascript to update avatar url.

    var url="https://community-qa.thomsonreuters.com/api.ashx/v2/users/"+userID+"/avatar.json";
    var Data= '{"AvatarUrl": "https://xxxxxxx.com/xxxx.png"}';
    var httpResponseResponse = core_v2_http.Put(url, { Data: Data, Headers: {"Rest-User-Token": 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Content-Type': 'application/json'}});


    Can you please suggest how we can update avatar url in automation using javascript?