Join BoxWorks 2024 to discover what's possible with content and AI!
Register now!Retrieves an image of a the user's avatar.
12345
The ID of the user.
When an avatar can be found for the user the image data will be returned in the body of the response.
An unexpected client error.
curl -i -X GET "https://api.box.com/2.0/users/12345/avatar" \
-H "authorization: Bearer <ACCESS_TOKEN>"
await client.avatars.getUserAvatar(user.id);
client.avatars.get_user_avatar(user.id)
await client.Avatars.GetUserAvatarAsync(userId: user.Id);
try await client.avatars.getUserAvatar(userId: user.id, downloadDestinationURL: URL(path: "\(Utils.temporaryDirectoryPath())\(Utils.getUUID())"))
String userID = "33333";
// some stream do download avatar
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()){
BoxUser user=new BoxUser(api,userID);
user.downloadAvatar(outputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
avatar = client.user('33333').get_avatar()
Stream imageStream = await client.UsersManager.GetUserAvatar(string userId);
client.users.getAvatar('22222')
.then(avatarImageStream => {
avatarImageStream.on('data', bytes => {
// read avatar image bytes
});
});
client.users.getAvatar(userId: "33333") { (result: Result<Data, BoxSDKError>) in
guard case let .success(avatarData) = result else {
print("Error getting user avatar")
return
}
let avatarImage = UIImage(data: avatarData)
}