docker_io_accounts_api.rst 9.8 KB

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