123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 |
- :title: Index API
- :description: API Documentation for Docker Index
- :keywords: API, Docker, index, REST, documentation
- =================
- Docker Index API
- =================
- 1. Brief introduction
- =====================
- - This is the REST API for the Docker index
- - Authorization is done with basic auth over SSL
- - Not all commands require authentication, only those noted as such.
- 2. Endpoints
- ============
- 2.1 Repository
- ^^^^^^^^^^^^^^
- Repositories
- *************
- User Repo
- ~~~~~~~~~
- .. http:put:: /v1/repositories/(namespace)/(repo_name)/
- Create a user repository with the given ``namespace`` and ``repo_name``.
- **Example Request**:
- .. sourcecode:: http
- PUT /v1/repositories/foo/bar/ HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic akmklmasadalkm==
- X-Docker-Token: true
- [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}]
- :parameter namespace: the namespace for the repo
- :parameter repo_name: the name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 200
- Vary: Accept
- Content-Type: application/json
- WWW-Authenticate: Token signature=123abc,repository="foo/bar",access=write
- X-Docker-Token: signature=123abc,repository="foo/bar",access=write
- X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
- ""
- :statuscode 200: Created
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active
- .. http:delete:: /v1/repositories/(namespace)/(repo_name)/
- Delete a user repository with the given ``namespace`` and ``repo_name``.
- **Example Request**:
- .. sourcecode:: http
- DELETE /v1/repositories/foo/bar/ HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic akmklmasadalkm==
- X-Docker-Token: true
- ""
- :parameter namespace: the namespace for the repo
- :parameter repo_name: the name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 202
- Vary: Accept
- Content-Type: application/json
- WWW-Authenticate: Token signature=123abc,repository="foo/bar",access=delete
- X-Docker-Token: signature=123abc,repository="foo/bar",access=delete
- X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
- ""
- :statuscode 200: Deleted
- :statuscode 202: Accepted
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active
- Library Repo
- ~~~~~~~~~~~~
- .. http:put:: /v1/repositories/(repo_name)/
- Create a library repository with the given ``repo_name``.
- This is a restricted feature only available to docker admins.
-
- When namespace is missing, it is assumed to be ``library``
- **Example Request**:
- .. sourcecode:: http
- PUT /v1/repositories/foobar/ HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic akmklmasadalkm==
- X-Docker-Token: true
- [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"}]
- :parameter repo_name: the library name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 200
- Vary: Accept
- Content-Type: application/json
- WWW-Authenticate: Token signature=123abc,repository="library/foobar",access=write
- X-Docker-Token: signature=123abc,repository="foo/bar",access=write
- X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
- ""
- :statuscode 200: Created
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active
- .. http:delete:: /v1/repositories/(repo_name)/
- Delete a library repository with the given ``repo_name``.
- This is a restricted feature only available to docker admins.
-
- When namespace is missing, it is assumed to be ``library``
- **Example Request**:
- .. sourcecode:: http
- DELETE /v1/repositories/foobar/ HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic akmklmasadalkm==
- X-Docker-Token: true
- ""
- :parameter repo_name: the library name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 202
- Vary: Accept
- Content-Type: application/json
- WWW-Authenticate: Token signature=123abc,repository="library/foobar",access=delete
- X-Docker-Token: signature=123abc,repository="foo/bar",access=delete
- X-Docker-Endpoints: registry-1.docker.io [, registry-2.docker.io]
- ""
- :statuscode 200: Deleted
- :statuscode 202: Accepted
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active
- Repository Images
- *****************
- User Repo Images
- ~~~~~~~~~~~~~~~~
- .. http:put:: /v1/repositories/(namespace)/(repo_name)/images
- Update the images for a user repo.
- **Example Request**:
- .. sourcecode:: http
- PUT /v1/repositories/foo/bar/images HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic akmklmasadalkm==
- [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
- "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}]
- :parameter namespace: the namespace for the repo
- :parameter repo_name: the name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 204
- Vary: Accept
- Content-Type: application/json
- ""
- :statuscode 204: Created
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active or permission denied
- .. http:get:: /v1/repositories/(namespace)/(repo_name)/images
- get the images for a user repo.
- **Example Request**:
- .. sourcecode:: http
- GET /v1/repositories/foo/bar/images HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- :parameter namespace: the namespace for the repo
- :parameter repo_name: the name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 200
- Vary: Accept
- Content-Type: application/json
- [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
- "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"},
- {"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds",
- "checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}]
- :statuscode 200: OK
- :statuscode 404: Not found
- Library Repo Images
- ~~~~~~~~~~~~~~~~~~~
- .. http:put:: /v1/repositories/(repo_name)/images
- Update the images for a library repo.
- **Example Request**:
- .. sourcecode:: http
- PUT /v1/repositories/foobar/images HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic akmklmasadalkm==
- [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
- "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"}]
- :parameter repo_name: the library name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 204
- Vary: Accept
- Content-Type: application/json
- ""
- :statuscode 204: Created
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active or permission denied
- .. http:get:: /v1/repositories/(repo_name)/images
- get the images for a library repo.
- **Example Request**:
- .. sourcecode:: http
- GET /v1/repositories/foobar/images HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- :parameter repo_name: the library name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 200
- Vary: Accept
- Content-Type: application/json
- [{"id": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
- "checksum": "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"},
- {"id": "ertwetewtwe38722009fe6857087b486531f9a779a0c1dfddgfgsdgdsgds",
- "checksum": "34t23f23fc17e3ed29dae8f12c4f9e89cc6f0bsdfgfsdgdsgdsgerwgew"}]
- :statuscode 200: OK
- :statuscode 404: Not found
- Repository Authorization
- ************************
- Library Repo
- ~~~~~~~~~~~~
- .. http:put:: /v1/repositories/(repo_name)/auth
- authorize a token for a library repo
- **Example Request**:
- .. sourcecode:: http
- PUT /v1/repositories/foobar/auth HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Authorization: Token signature=123abc,repository="library/foobar",access=write
- :parameter repo_name: the library name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 200
- Vary: Accept
- Content-Type: application/json
- "OK"
- :statuscode 200: OK
- :statuscode 403: Permission denied
- :statuscode 404: Not found
- User Repo
- ~~~~~~~~~
- .. http:put:: /v1/repositories/(namespace)/(repo_name)/auth
- authorize a token for a user repo
- **Example Request**:
- .. sourcecode:: http
- PUT /v1/repositories/foo/bar/auth HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Authorization: Token signature=123abc,repository="foo/bar",access=write
- :parameter namespace: the namespace for the repo
- :parameter repo_name: the name for the repo
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 200
- Vary: Accept
- Content-Type: application/json
- "OK"
- :statuscode 200: OK
- :statuscode 403: Permission denied
- :statuscode 404: Not found
- 2.2 Users
- ^^^^^^^^^
- User Login
- **********
- .. http:get:: /v1/users
- If you want to check your login, you can try this endpoint
-
- **Example Request**:
-
- .. sourcecode:: http
-
- GET /v1/users HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Authorization: Basic akmklmasadalkm==
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 200 OK
- Vary: Accept
- Content-Type: application/json
- OK
- :statuscode 200: no error
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active
- User Register
- *************
- .. http:post:: /v1/users
- Registering a new account.
- **Example request**:
- .. sourcecode:: http
- POST /v1/users HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- {"email": "sam@dotcloud.com",
- "password": "toto42",
- "username": "foobar"'}
- :jsonparameter email: valid email address, that needs to be confirmed
- :jsonparameter username: min 4 character, max 30 characters, must match the regular expression [a-z0-9\_].
- :jsonparameter password: min 5 characters
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 201 OK
- Vary: Accept
- Content-Type: application/json
- "User Created"
- :statuscode 201: User Created
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- Update User
- ***********
- .. http:put:: /v1/users/(username)/
- Change a password or email address for given user. If you pass in an email,
- it will add it to your account, it will not remove the old one. Passwords will
- be updated.
- It is up to the client to verify that that password that is sent is the one that
- they want. Common approach is to have them type it twice.
- **Example Request**:
- .. sourcecode:: http
- PUT /v1/users/fakeuser/ HTTP/1.1
- Host: index.docker.io
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic akmklmasadalkm==
- {"email": "sam@dotcloud.com",
- "password": "toto42"}
- :parameter username: username for the person you want to update
- **Example Response**:
- .. sourcecode:: http
- HTTP/1.1 204
- Vary: Accept
- Content-Type: application/json
- ""
- :statuscode 204: User Updated
- :statuscode 400: Errors (invalid json, missing or invalid fields, etc)
- :statuscode 401: Unauthorized
- :statuscode 403: Account is not Active
- :statuscode 404: User not found
- 2.3 Search
- ^^^^^^^^^^
- If you need to search the index, this is the endpoint you would use.
- Search
- ******
- .. http:get:: /v1/search
- Search the Index given a search term. It accepts :http:method:`get` only.
- **Example request**:
- .. sourcecode:: http
- GET /v1/search?q=search_term HTTP/1.1
- Host: example.com
- Accept: application/json
- **Example response**:
- .. sourcecode:: http
- HTTP/1.1 200 OK
- Vary: Accept
- Content-Type: application/json
- {"query":"search_term",
- "num_results": 3,
- "results" : [
- {"name": "ubuntu", "description": "An ubuntu image..."},
- {"name": "centos", "description": "A centos image..."},
- {"name": "fedora", "description": "A fedora image..."}
- ]
- }
- :query q: what you want to search for
- :statuscode 200: no error
- :statuscode 500: server error
|