debian-mirror-gitlab/doc/api/avatar.md

48 lines
1.7 KiB
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
2021-06-08 01:23:25 +05:30
stage: Manage
2022-03-02 08:16:31 +05:30
group: Authentication & Authorization
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2021-01-29 00:20:46 +05:30
---
2021-11-11 11:23:49 +05:30
# Avatar API **(FREE)**
2018-11-08 19:23:39 +05:30
2020-03-13 15:44:24 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/19121) in GitLab 11.0.
2018-11-08 19:23:39 +05:30
## Get a single avatar URL
2021-04-17 20:07:23 +05:30
Get a single [avatar](../user/profile/index.md#access-your-user-settings) URL for a user with the given email address.
2018-11-08 19:23:39 +05:30
2019-03-02 22:35:43 +05:30
If:
- No user with the given public email address is found, results from external avatar services are
returned.
2021-02-22 17:27:13 +05:30
- Public visibility is restricted, response is `403 Forbidden` when unauthenticated.
2019-03-02 22:35:43 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2019-03-02 22:35:43 +05:30
This endpoint can be accessed without authentication.
2020-05-24 23:13:21 +05:30
```plaintext
2018-11-08 19:23:39 +05:30
GET /avatar?email=admin@example.com
```
2019-03-02 22:35:43 +05:30
Parameters:
2018-11-08 19:23:39 +05:30
2019-03-02 22:35:43 +05:30
| Attribute | Type | Required | Description |
|:----------|:--------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------|
| `email` | string | yes | Public email address of the user. |
2021-03-08 18:12:59 +05:30
| `size` | integer | no | Single pixel dimension (because images are squares). Only used for avatar lookups at `Gravatar` or at the configured `Libravatar` server. |
2019-03-02 22:35:43 +05:30
Example request:
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl "https://gitlab.example.com/api/v4/avatar?email=admin@example.com&size=32"
2018-11-08 19:23:39 +05:30
```
Example response:
```json
{
2019-03-02 22:35:43 +05:30
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=64&d=identicon"
2018-11-08 19:23:39 +05:30
}
```