Mattermost, Inc.

How to use api to get profile image?

It seems that you can get the user profile using “…/api/v4/users/USER_ID/image”.

But the returned value looks like an encoded value, how do I convert it? I am a novice developer, so I am not sure what to do.

Any advice would be greatly appreciated.

Hi, @Karmantez

Can I please confirm if you are getting something like this on your end?

Ahmad-Danials-MacBook-Pro:~ ahmaddanialmohammad$ curl --location --request GET "https://mattermost.test.com/api/v4/users/XXXXXXXX/image" --header "Authorization: Bearer XXXXXXXX" --header "Content-Type: application/json"
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.

Additionally, when you output it to a file, it just shows random characters?

Ahmad-Danials-MacBook-Pro:~ ahmaddanialmohammad$ curl --location --request GET "https://mattermost.test.com/api/v4/users/XXXXXXXXXX/image" --header "Authorization: Bearer XXXXXXXXX" --header "Content-Type: application/json" --output test.txt