docker_io_accounts_api.rst 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. :title: docker.io Accounts API
  2. :description: API Documentation for docker.io accounts.
  3. :keywords: API, Docker, accounts, REST, documentation
  4. ======================
  5. docker.io Accounts API
  6. ======================
  7. .. contents:: Table of Contents
  8. 1. Endpoints
  9. ============
  10. 1.1 Get a single user
  11. ^^^^^^^^^^^^^^^^^^^^^
  12. .. http:get:: /api/v1.1/users/:username/
  13. Get profile info for the specified user.
  14. :param username: username of the user whose profile info is being requested.
  15. :reqheader Authorization: required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
  16. :statuscode 200: success, user data returned.
  17. :statuscode 401: authentication error.
  18. :statuscode 403: permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have ``profile_read`` scope.
  19. :statuscode 404: the specified username does not exist.
  20. **Example request**:
  21. .. sourcecode:: http
  22. GET /api/v1.1/users/janedoe/ HTTP/1.1
  23. Host: www.docker.io
  24. Accept: application/json
  25. Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
  26. **Example response**:
  27. .. sourcecode:: http
  28. HTTP/1.1 200 OK
  29. Content-Type: application/json
  30. {
  31. "id": 2,
  32. "username": "janedoe",
  33. "url": "",
  34. "date_joined": "2014-02-12T17:58:01.431312Z",
  35. "type": "User",
  36. "full_name": "Jane Doe",
  37. "location": "San Francisco, CA",
  38. "company": "Success, Inc.",
  39. "profile_url": "https://docker.io/",
  40. "gravatar_email": "jane.doe+gravatar@example.com",
  41. "email": "jane.doe@example.com",
  42. "is_active": true
  43. }
  44. 1.2 Update a single user
  45. ^^^^^^^^^^^^^^^^^^^^^^^^
  46. .. http:patch:: /api/v1.1/users/:username/
  47. Update profile info for the specified user.
  48. :param username: username of the user whose profile info is being updated.
  49. :jsonparam string full_name: (optional) the new name of the user.
  50. :jsonparam string location: (optional) the new location.
  51. :jsonparam string company: (optional) the new company of the user.
  52. :jsonparam string profile_url: (optional) the new profile url.
  53. :jsonparam string gravatar_email: (optional) the new Gravatar email address.
  54. :reqheader Authorization: required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
  55. :reqheader Content-Type: MIME Type of post data. JSON, url-encoded form data, etc.
  56. :statuscode 200: success, user data updated.
  57. :statuscode 400: post data validation error.
  58. :statuscode 401: authentication error.
  59. :statuscode 403: permission error, authenticated user must be the user whose data is being updated, OAuth access tokens must have ``profile_write`` scope.
  60. :statuscode 404: the specified username does not exist.
  61. **Example request**:
  62. .. sourcecode:: http
  63. PATCH /api/v1.1/users/janedoe/ HTTP/1.1
  64. Host: www.docker.io
  65. Accept: application/json
  66. Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
  67. {
  68. "location": "Private Island",
  69. "profile_url": "http://janedoe.com/",
  70. "company": "Retired",
  71. }
  72. **Example response**:
  73. .. sourcecode:: http
  74. HTTP/1.1 200 OK
  75. Content-Type: application/json
  76. {
  77. "id": 2,
  78. "username": "janedoe",
  79. "url": "",
  80. "date_joined": "2014-02-12T17:58:01.431312Z",
  81. "type": "User",
  82. "full_name": "Jane Doe",
  83. "location": "Private Island",
  84. "company": "Retired",
  85. "profile_url": "http://janedoe.com/",
  86. "gravatar_email": "jane.doe+gravatar@example.com",
  87. "email": "jane.doe@example.com",
  88. "is_active": true
  89. }
  90. 1.3 List email addresses for a user
  91. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  92. .. http:get:: /api/v1.1/users/:username/emails/
  93. List email info for the specified user.
  94. :param username: username of the user whose profile info is being updated.
  95. :reqheader Authorization: required authentication credentials of either type HTTP Basic or OAuth Bearer Token
  96. :statuscode 200: success, user data updated.
  97. :statuscode 401: authentication error.
  98. :statuscode 403: permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have ``email_read`` scope.
  99. :statuscode 404: the specified username does not exist.
  100. **Example request**:
  101. .. sourcecode:: http
  102. GET /api/v1.1/users/janedoe/emails/ HTTP/1.1
  103. Host: www.docker.io
  104. Accept: application/json
  105. Authorization: Bearer zAy0BxC1wDv2EuF3tGs4HrI6qJp6KoL7nM
  106. **Example response**:
  107. .. sourcecode:: http
  108. HTTP/1.1 200 OK
  109. Content-Type: application/json
  110. [
  111. {
  112. "email": "jane.doe@example.com",
  113. "verified": true,
  114. "primary": true
  115. }
  116. ]
  117. 1.4 Add email address for a user
  118. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  119. .. http:post:: /api/v1.1/users/:username/emails/
  120. Add a new email address to the specified user's account. The email address
  121. must be verified separately, a confirmation email is not automatically sent.
  122. :jsonparam string email: email address to be added.
  123. :reqheader Authorization: required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
  124. :reqheader Content-Type: MIME Type of post data. JSON, url-encoded form data, etc.
  125. :statuscode 201: success, new email added.
  126. :statuscode 400: data validation error.
  127. :statuscode 401: authentication error.
  128. :statuscode 403: permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have ``email_write`` scope.
  129. :statuscode 404: the specified username does not exist.
  130. **Example request**:
  131. .. sourcecode:: http
  132. POST /api/v1.1/users/janedoe/emails/ HTTP/1.1
  133. Host: www.docker.io
  134. Accept: application/json
  135. Content-Type: application/json
  136. Authorization: Bearer zAy0BxC1wDv2EuF3tGs4HrI6qJp6KoL7nM
  137. {
  138. "email": "jane.doe+other@example.com"
  139. }
  140. **Example response**:
  141. .. sourcecode:: http
  142. HTTP/1.1 201 Created
  143. Content-Type: application/json
  144. {
  145. "email": "jane.doe+other@example.com",
  146. "verified": false,
  147. "primary": false
  148. }
  149. 1.5 Update an email address for a user
  150. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  151. .. http:patch:: /api/v1.1/users/:username/emails/
  152. Update an email address for the specified user to either verify an email
  153. address or set it as the primary email for the user. You cannot use this
  154. endpoint to un-verify an email address. You cannot use this endpoint to
  155. unset the primary email, only set another as the primary.
  156. :param username: username of the user whose email info is being updated.
  157. :jsonparam string email: the email address to be updated.
  158. :jsonparam boolean verified: (optional) whether the email address is verified, must be ``true`` or absent.
  159. :jsonparam boolean primary: (optional) whether to set the email address as the primary email, must be ``true`` or absent.
  160. :reqheader Authorization: required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
  161. :reqheader Content-Type: MIME Type of post data. JSON, url-encoded form data, etc.
  162. :statuscode 200: success, user's email updated.
  163. :statuscode 400: data validation error.
  164. :statuscode 401: authentication error.
  165. :statuscode 403: permission error, authenticated user must be the user whose data is being updated, OAuth access tokens must have ``email_write`` scope.
  166. :statuscode 404: the specified username or email address does not exist.
  167. **Example request**:
  168. Once you have independently verified an email address.
  169. .. sourcecode:: http
  170. PATCH /api/v1.1/users/janedoe/emails/ HTTP/1.1
  171. Host: www.docker.io
  172. Accept: application/json
  173. Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
  174. {
  175. "email": "jane.doe+other@example.com",
  176. "verified": true,
  177. }
  178. **Example response**:
  179. .. sourcecode:: http
  180. HTTP/1.1 200 OK
  181. Content-Type: application/json
  182. {
  183. "email": "jane.doe+other@example.com",
  184. "verified": true,
  185. "primary": false
  186. }
  187. 1.6 Delete email address for a user
  188. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  189. .. http:delete:: /api/v1.1/users/:username/emails/
  190. Delete an email address from the specified user's account. You cannot
  191. delete a user's primary email address.
  192. :jsonparam string email: email address to be deleted.
  193. :reqheader Authorization: required authentication credentials of either type HTTP Basic or OAuth Bearer Token.
  194. :reqheader Content-Type: MIME Type of post data. JSON, url-encoded form data, etc.
  195. :statuscode 204: success, email address removed.
  196. :statuscode 400: validation error.
  197. :statuscode 401: authentication error.
  198. :statuscode 403: permission error, authenticated user must be the user whose data is being requested, OAuth access tokens must have ``email_write`` scope.
  199. :statuscode 404: the specified username or email address does not exist.
  200. **Example request**:
  201. .. sourcecode:: http
  202. DELETE /api/v1.1/users/janedoe/emails/ HTTP/1.1
  203. Host: www.docker.io
  204. Accept: application/json
  205. Content-Type: application/json
  206. Authorization: Bearer zAy0BxC1wDv2EuF3tGs4HrI6qJp6KoL7nM
  207. {
  208. "email": "jane.doe+other@example.com"
  209. }
  210. **Example response**:
  211. .. sourcecode:: http
  212. HTTP/1.1 204 NO CONTENT
  213. Content-Length: 0