docker.io Accounts API

Get a single user

  1. GET /api/v1.1/users/:username/

获取指定用户的个人信息。

参数:

  • username – 被要求获取的用户信息的用户名。

Request Headers:

  • Authorization – required authentication credentials of either type HTTP Basic or OAuth Bearer Token.

 状态码:

  • 200 – 成功返回用户数据。
  • 401 – 权限认证错误。
  • 403 – 许可错误, 具有权限认证的用户必须是被请求的用户,OAuth access tokens 必须有 profile_read
  • 404 – 指定的用户名不纯在。

 Example request:

  1. GET /api/v1.1/users/janedoe/ HTTP/1.1
  2. Host: www.docker.io
  3. Accept: application/json
  4. Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Example response:

  1. HTTP/1.1 200 OK
  2. Content-Type: application/json
  3. {
  4. "id": 2,
  5. "username": "janedoe",
  6. "url": "https://www.docker.io/api/v1.1/users/janedoe/",
  7. "date_joined": "2014-02-12T17:58:01.431312Z",
  8. "type": "User",
  9. "full_name": "Jane Doe",
  10. "location": "San Francisco, CA",
  11. "company": "Success, Inc.",
  12. "profile_url": "https://docker.io/",
  13. "gravatar_url": "https://secure.gravatar.com/avatar/0212b397124be4acd4e7dea9aa357.jpg?s=80&r=g&d=mm"
  14. "email": "jane.doe@example.com",
  15. "is_active": true
  16. }

Update a single user

  1. PATCH /api/v1.1/users/:username/

修改指定用户的用户信息.

参数:

  • username – username of the user whose profile info is being updated.

Json参数:

  • full_name (string) – (optional) the new name of the user.
  • location (string) – (optional) the new location.
  • company (string) – (optional) the new company of the user.
  • profile_url (string) – (optional) the new profile url.
  • gravatar_email (string) – (optional) the new Gravatar email address.

Request Headers:

  • Authorization – required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
  • Content-Type – MIME Type of post data. JSON, url-encoded form data, etc.

状态码:

  • 200 – success, user data updated.
  • 400 – post data validation error.
  • 401 – authentication error.
  • 403 – permission error, authenticated user must be the user whose data is being updated, OAuth access tokens must have profile_write scope.
  • 404 – the specified username does not exist.

Example request:

  1. PATCH /api/v1.1/users/janedoe/ HTTP/1.1
  2. Host: www.docker.io
  3. Accept: application/json
  4. Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
  5. {
  6. "location": "Private Island",
  7. "profile_url": "http://janedoe.com/",
  8. "company": "Retired",
  9. }

Example response:

  1. HTTP/1.1 200 OK
  2. Content-Type: application/json
  3. {
  4. "id": 2,
  5. "username": "janedoe",
  6. "url": "https://www.docker.io/api/v1.1/users/janedoe/",
  7. "date_joined": "2014-02-12T17:58:01.431312Z",
  8. "type": "User",
  9. "full_name": "Jane Doe",
  10. "location": "Private Island",
  11. "company": "Retired",
  12. "profile_url": "http://janedoe.com/",
  13. "gravatar_url": "https://secure.gravatar.com/avatar/0212b397124be4acd4e7dea9aa357.jpg?s=80&r=g&d=mm"
  14. "email": "jane.doe@example.com",
  15. "is_active": true
  16. }

 列举用户的Email地址

  1. GET /api/v1.1/users/:username/emails/

List email info for the specified user.

参数:

username – username of the user whose profile info is being updated.

Request Headers:

Authorization – required authentication credentials of either type HTTP Basic or OAuth Bearer Token

状态码:

  • 200 – success, user data updated.
  • 401 – authentication error.
  • 403 – permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have email_read scope.
  • 404 – the specified username does not exist.

Example request:

  1. GET /api/v1.1/users/janedoe/emails/ HTTP/1.1
  2. Host: www.docker.io
  3. Accept: application/json
  4. Authorization: Bearer zAy0BxC1wDv2EuF3tGs4HrI6qJp6KoL7nM

Example response:

  1. HTTP/1.1 200 OK
  2. Content-Type: application/json
  3. [
  4. {
  5. "email": "jane.doe@example.com",
  6. "verified": true,
  7. "primary": true
  8. }
  9. ]

Add email address for a user

  1. POST /api/v1.1/users/:username/emails/

Add a new email address to the specified user’s account. The email address must be verified separately, a confirmation email is not automatically sent.

Json Parameters:

email (string) – email address to be added.

Request Headers:

Authorization – required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
Content-Type – MIME Type of post data. JSON, url-encoded form data, etc.

状态码:

  • 201 – success, new email added.
  • 400 – data validation error.
  • 401 – authentication error.
  • 403 – permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have email_write scope.
  • 404 – the specified username does not exist.

Example request:

  1. POST /api/v1.1/users/janedoe/emails/ HTTP/1.1
  2. Host: www.docker.io
  3. Accept: application/json
  4. Content-Type: application/json
  5. Authorization: Bearer zAy0BxC1wDv2EuF3tGs4HrI6qJp6KoL7nM
  6. {
  7. "email": "jane.doe+other@example.com"
  8. }

Example response:

  1. HTTP/1.1 201 Created
  2. Content-Type: application/json
  3. {
  4. "email": "jane.doe+other@example.com",
  5. "verified": false,
  6. "primary": false
  7. }

Delete email address for a user

  1. DELETE /api/v1.1/users/:username/emails/

Delete an email address from the specified user’s account. You cannot delete a user’s primary email address.

 Json Parameters:

email (string) – email address to be deleted.

Request Headers:

Authorization – required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
Content-Type – MIME Type of post data. JSON, url-encoded form data, etc.

状态码:

  • 204 – success, email address removed.
  • 400 – validation error.
  • 401 – authentication error.
  • 403 – permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have email_write scope.
  • 404 – the specified username or email address does not exist.

Example request:

  1. DELETE /api/v1.1/users/janedoe/emails/ HTTP/1.1
  2. Host: www.docker.io
  3. Accept: application/json
  4. Content-Type: application/json
  5. Authorization: Bearer zAy0BxC1wDv2EuF3tGs4HrI6qJp6KoL7nM
  6. {
  7. "email": "jane.doe+other@example.com"
  8. }

Example response:

  1. HTTP/1.1 204 NO CONTENT
  2. Content-Length: 0