This page describes the account related REST endpoints. Please also take note of the general information on the REST API.
GET /accounts/
Queries accounts visible to the caller. The query string must be provided by the q
parameter. The n
parameter can be used to limit the returned results.
As result a list of AccountInfo entities is returned.
Request.
GET /accounts/?q=name:John+email:example.com&n=2 HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "_account_id": 1000096, }, { "_account_id": 1001439, "_more_accounts": true } ]
If the number of accounts matching the query exceeds either the internal limit or a supplied n
query parameter, the last account object has a _more_accounts: true
JSON field set.
The S
or start
query parameter can be supplied to skip a number of accounts from the list.
Additional fields can be obtained by adding o
parameters, each option slows down the query response time to the client so they are generally disabled by default. Optional fields are:
DETAILS
: Includes full name, preferred email, username and avatars for each account.ALL_EMAILS
: Includes all registered emails.To get account suggestions set the parameter suggest
and provide the typed substring as query q
. If a result limit n
is not specified, then the default 10 is used.
For account suggestions account details and all emails are always returned.
Request.
GET /accounts/?suggest&q=John HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "_account_id": 1000096, "name": "John Doe", "email": "john.doe@example.com", "username": "john" }, { "_account_id": 1001439, "name": "John Smith", "email": "john.smith@example.com", "username": "jsmith" }, ]
GET /accounts/{account-id}
Returns an account as an AccountInfo entity.
Request.
GET /accounts/self HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "_account_id": 1000096, "name": "John Doe", "email": "john.doe@example.com", "username": "john" }
PUT /accounts/{username}
Creates a new account.
In the request body additional data for the account can be provided as AccountInput.
Request.
PUT /accounts/john HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "name": "John Doe", "email": "john.doe@example.com", "ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw==", "http_password": "19D9aIn7zePb", "groups": [ "MyProject-Owners" ] }
As response a detailed AccountInfo entity is returned that describes the created account.
Response.
HTTP/1.1 201 Created Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "_account_id": 1000195, "name": "John Doe", "email": "john.doe@example.com" }
GET /accounts/{account-id}/detail
Retrieves the details of an account as an AccountDetailInfo entity.
Request.
GET /accounts/self/detail HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "registered_on": "2015-07-23 07:01:09.296000000", "_account_id": 1000096, "name": "John Doe", "email": "john.doe@example.com", "username": "john" }
GET /accounts/{account-id}/name
Retrieves the full name of an account.
Request.
GET /accounts/self/name HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' "John Doe"
If the account does not have a name an empty string is returned.
PUT /accounts/{account-id}/name
Sets the full name of an account.
The new account name must be provided in the request body inside an AccountNameInput entity.
Request.
PUT /accounts/self/name HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "name": "John F. Doe" }
As response the new account name is returned.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' "John F. Doe"
If the name was deleted the response is “204 No Content
”.
Some realms may not allow to modify the account name. In this case the request is rejected with “405 Method Not Allowed
”.
DELETE /accounts/{account-id}/name
Deletes the name of an account.
Request.
DELETE /accounts/self/name HTTP/1.0
Response.
HTTP/1.1 204 No Content
GET /accounts/{account-id}/status
Retrieves the status of an account.
Request.
GET /accounts/self/status HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' "Available"
If the account does not have a status an empty string is returned.
PUT /accounts/{account-id}/status
Sets the status of an account.
The new account status must be provided in the request body inside an AccountStatusInput entity.
Request.
PUT /accounts/self/status HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "status": "Out Of Office" }
As response the new account status is returned.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' "Out Of Office"
If the name was deleted the response is “204 No Content
”.
GET /accounts/{account-id}/username
Retrieves the username of an account.
Request.
GET /accounts/self/username HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' "john.doe"
If the account does not have a username the response is “404 Not Found
”.
PUT /accounts/{account-id}/username
The new username must be provided in the request body inside a UsernameInput entity.
Once set, the username cannot be changed or deleted. If attempted this fails with “405 Method Not Allowed
”.
Request.
PUT /accounts/self/username HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "username": "jdoe" }
As response the new username is returned.
GET /accounts/{account-id}/active
Checks if an account is active.
Request.
GET /accounts/john.doe@example.com/active HTTP/1.0
If the account is active the string ok
is returned.
Response.
HTTP/1.1 200 OK ok
If the account is inactive the response is “204 No Content
”.
PUT /accounts/{account-id}/active
Sets the account state to active.
Request.
PUT /accounts/john.doe@example.com/active HTTP/1.0
Response.
HTTP/1.1 201 Created
If the account was already active the response is “200 OK
”.
DELETE /accounts/{account-id}/active
Sets the account state to inactive.
Request.
DELETE /accounts/john.doe@example.com/active HTTP/1.0
Response.
HTTP/1.1 204 No Content
If the account was already inactive the response is “409 Conflict
”.
PUT /accounts/{account-id}/password.http
Sets/Generates the HTTP password of an account.
The options for setting/generating the HTTP password must be provided in the request body inside a HttpPasswordInput entity.
Request.
PUT /accounts/self/password.http HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "generate": true }
As response the new HTTP password is returned.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' "ETxgpih8xrNs"
If the HTTP password was deleted the response is “204 No Content
”.
DELETE /accounts/{account-id}/password.http
Deletes the HTTP password of an account.
Request.
DELETE /accounts/self/password.http HTTP/1.0
Response.
HTTP/1.1 204 No Content
GET /accounts/{account-id}/oauthtoken
Returns a previously obtained OAuth access token.
Request.
GET /accounts/self/oauthtoken HTTP/1.1
As a response, an OAuthTokenInfo entity is returned that describes the OAuth access token.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "username": "johndow", "resource_host": "gerrit.example.org", "access_token": "eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOi", "provider_id": "oauth-plugin:oauth-provider", "expires_at": "922337203775807", "type": "bearer" }
If there is no token available, or the token has already expired, “404 Not Found
” is returned as response. Requests to obtain an access token of another user are rejected with “403 Forbidden
”.
GET /accounts/{account-id}/emails
Returns the email addresses that are configured for the specified user.
Request.
GET /accounts/self/emails HTTP/1.0
As response the email addresses of the user are returned as a list of EmailInfo entities.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "email": "john.doe@example.com", "preferred": true }, { "email": "j.doe@example.com" } ]
GET /accounts/{account-id}/emails/{email-id}
Retrieves an email address of a user.
Request.
GET /accounts/self/emails/john.doe@example.com HTTP/1.0
As response an EmailInfo entity is returned that describes the email address.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "email": "john.doe@example.com", "preferred": true }
PUT /accounts/{account-id}/emails/{email-id}
Registers a new email address for the user. A verification email is sent with a link that needs to be visited to confirm the email address, unless DEVELOPMENT_BECOME_ANY_ACCOUNT
is used as authentication type. For the development mode email addresses are directly added without confirmation. A Gerrit administrator may add an email address without confirmation by setting no_confirmation
in the EmailInput. If sendemail.allowrcpt is configured, the added email address must belong to a domain that is allowed, unless no_confirmation
is set.
The EmailInput object in the request body may contain additional options for the email address.
Request.
PUT /accounts/self/emails/john.doe@example.com HTTP/1.0 Content-Type: application/json; charset=UTF-8 Content-Length: 3 {}
As response the new email address is returned as EmailInfo entity.
Response.
HTTP/1.1 201 Created Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "email": "john.doe@example.com", "pending_confirmation": true }
DELETE /accounts/{account-id}/emails/{email-id}
Deletes an email address of an account.
Request.
DELETE /accounts/self/emails/john.doe@example.com HTTP/1.0
Response.
HTTP/1.1 204 No Content
PUT /accounts/{account-id}/emails/{email-id}/preferred
Sets an email address as preferred email address for an account.
Request.
PUT /accounts/self/emails/john.doe@example.com/preferred HTTP/1.0
Response.
HTTP/1.1 201 Created
If the email address was already the preferred email address of the account the response is “200 OK
”.
GET /accounts/{account-id}/sshkeys
Returns the SSH keys of an account.
Request.
GET /accounts/self/sshkeys HTTP/1.0
As response the SSH keys of the account are returned as a list of SshKeyInfo entities.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "seq": 1, "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d john.doe@example.com", "encoded_key": "AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d", "algorithm": "ssh-rsa", "comment": "john.doe@example.com", "valid": true } ]
GET /accounts/{account-id}/sshkeys/{ssh-key-id}
Retrieves an SSH key of a user.
Request.
GET /accounts/self/sshkeys/1 HTTP/1.0
As response an SshKeyInfo entity is returned that describes the SSH key.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "seq": 1, "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d john.doe@example.com", "encoded_key": "AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d", "algorithm": "ssh-rsa", "comment": "john.doe@example.com", "valid": true }
POST /accounts/{account-id}/sshkeys
Adds an SSH key for a user.
The SSH public key must be provided as raw content in the request body.
Trying to add an SSH key that already exists succeeds, but no new SSH key is persisted.
Request.
POST /accounts/self/sshkeys HTTP/1.0 Content-Type: plain/text AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d
As response an SshKeyInfo entity is returned that describes the new SSH key.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "seq": 2, "ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d john.doe@example.com", "encoded_key": "AAAAB3NzaC1yc2EAAAABIwAAAQEA0T...YImydZAw\u003d\u003d", "algorithm": "ssh-rsa", "comment": "john.doe@example.com", "valid": true }
DELETE /accounts/{account-id}/sshkeys/{ssh-key-id}
Deletes an SSH key of a user.
Request.
DELETE /accounts/self/sshkeys/2 HTTP/1.0
Response.
HTTP/1.1 204 No Content
GET /accounts/{account-id}/gpgkeys
Returns the GPG keys of an account.
Request.
GET /accounts/self/gpgkeys HTTP/1.0
As a response, the GPG keys of the account are returned as a map of GpgKeyInfo entities, keyed by ID.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "AFC8A49B": { "fingerprint": "0192 723D 42D1 0C5B 32A6 E1E0 9350 9E4B AFC8 A49B", "user_ids": [ "John Doe \u003cjohn.doe@example.com\u003e" ], "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: BCPG v1.52\n\nmQENBFXUpNcBCACv4paCiyKxZ0EcKy8VaWVNkJlNebRBiyw9WxU85wPOq5Gz/3GT\nRQwKqeY0SxVdQT8VNBw2sBe2m6eqcfZ2iKmesSlbXMe15DA7k8Bg4zEpQ0tXNG1L\nhceZDVQ1Xk06T2sgkunaiPsXi82nwN3UWYtDXxX4is5e6xBNL48Jgz4lbqo6+8D5\nvsVYiYMx4AwRkJyt/oA3IZAtSlY8Yd445nY14VPcnsGRwGWTLyZv9gxKHRUppVhQ\nE3o6ePXKEVgmONnQ4CjqmkGwWZvjMF2EPtAxvQLAuFa8Hqtkq5cgfgVkv/Vrcln4\nnQZVoMm3a3f5ODii2tQzNh6+7LL1bpqAmVEtABEBAAG0H0pvaG4gRG9lIDxqb2hu\nLmRvZUBleGFtcGxlLmNvbT6JATgEEwECACIFAlXUpNcCGwMGCwkIBwMCBhUIAgkK\nCwQWAgMBAh4BAheAAAoJEJNQnkuvyKSbfjoH/2OcSQOu1kJ20ndjhgY2yNChm7gd\ntU7TEBbB0TsLeazkrrLtKvrpW5+CRe07ZAG9HOtp3DikwAyrhSxhlYgVsQDhgB8q\nG0tYiZtQ88YyYrncCQ4hwknrcWXVW9bK3V4ZauxzPv3ADSloyR9tMURw5iHCIeL5\nfIw/pLvA3RjPMx4Sfow/bqRCUELua39prGw5Tv8a2ZRFbj2sgP5j8lUFegyJPQ4z\ntJhe6zZvKOzvIyxHO8llLmdrImsXRL9eqroWGs0VYqe6baQpY6xpSjbYK0J5HYcg\nTO+/u80JI+ROTMHE6unGp5Pgh/xIz6Wd34E0lWL1eOyNfGiPLyRWn1d0", "status": "TRUSTED", "problems": [], }, }
GET /accounts/{account-id}/gpgkeys/{gpg-key-id}
Retrieves a GPG key of a user.
Request.
GET /accounts/self/gpgkeys/AFC8A49B HTTP/1.0
As a response, a GpgKeyInfo entity is returned that describes the GPG key.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "id": "AFC8A49B", "fingerprint": "0192 723D 42D1 0C5B 32A6 E1E0 9350 9E4B AFC8 A49B", "user_ids": [ "John Doe \u003cjohn.doe@example.com\u003e" ], "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: BCPG v1.52\n\nmQENBFXUpNcBCACv4paCiyKxZ0EcKy8VaWVNkJlNebRBiyw9WxU85wPOq5Gz/3GT\nRQwKqeY0SxVdQT8VNBw2sBe2m6eqcfZ2iKmesSlbXMe15DA7k8Bg4zEpQ0tXNG1L\nhceZDVQ1Xk06T2sgkunaiPsXi82nwN3UWYtDXxX4is5e6xBNL48Jgz4lbqo6+8D5\nvsVYiYMx4AwRkJyt/oA3IZAtSlY8Yd445nY14VPcnsGRwGWTLyZv9gxKHRUppVhQ\nE3o6ePXKEVgmONnQ4CjqmkGwWZvjMF2EPtAxvQLAuFa8Hqtkq5cgfgVkv/Vrcln4\nnQZVoMm3a3f5ODii2tQzNh6+7LL1bpqAmVEtABEBAAG0H0pvaG4gRG9lIDxqb2hu\nLmRvZUBleGFtcGxlLmNvbT6JATgEEwECACIFAlXUpNcCGwMGCwkIBwMCBhUIAgkK\nCwQWAgMBAh4BAheAAAoJEJNQnkuvyKSbfjoH/2OcSQOu1kJ20ndjhgY2yNChm7gd\ntU7TEBbB0TsLeazkrrLtKvrpW5+CRe07ZAG9HOtp3DikwAyrhSxhlYgVsQDhgB8q\nG0tYiZtQ88YyYrncCQ4hwknrcWXVW9bK3V4ZauxzPv3ADSloyR9tMURw5iHCIeL5\nfIw/pLvA3RjPMx4Sfow/bqRCUELua39prGw5Tv8a2ZRFbj2sgP5j8lUFegyJPQ4z\ntJhe6zZvKOzvIyxHO8llLmdrImsXRL9eqroWGs0VYqe6baQpY6xpSjbYK0J5HYcg\nTO+/u80JI+ROTMHE6unGp5Pgh/xIz6Wd34E0lWL1eOyNfGiPLyRWn1d0", "status": "TRUSTED", "problems": [], }
POST /accounts/{account-id}/gpgkeys
Add or delete one or more GPG keys for a user.
The changes must be provided in the request body as a GpgKeysInput entity. Each new GPG key is provided in ASCII armored format, and must contain a self-signed certification matching a registered email or other identity of the user.
Request.
POST /accounts/link:#account-id[\{account-id\}]/gpgkeys Content-Type: application/json { "add": [ "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1\n\nmQENBFXUpNcBCACv4paCiyKxZ0EcKy8VaWVNkJlNebRBiyw9WxU85wPOq5Gz/3GT\nRQwKqeY0SxVdQT8VNBw2sBe2m6eqcfZ2iKmesSlbXMe15DA7k8Bg4zEpQ0tXNG1L\nhceZDVQ1Xk06T2sgkunaiPsXi82nwN3UWYtDXxX4is5e6xBNL48Jgz4lbqo6+8D5\nvsVYiYMx4AwRkJyt/oA3IZAtSlY8Yd445nY14VPcnsGRwGWTLyZv9gxKHRUppVhQ\nE3o6ePXKEVgmONnQ4CjqmkGwWZvjMF2EPtAxvQLAuFa8Hqtkq5cgfgVkv/Vrcln4\nnQZVoMm3a3f5ODii2tQzNh6+7LL1bpqAmVEtABEBAAG0H0pvaG4gRG9lIDxqb2hu\nLmRvZUBleGFtcGxlLmNvbT6JATgEEwECACIFAlXUpNcCGwMGCwkIBwMCBhUIAgkK\nCwQWAgMBAh4BAheAAAoJEJNQnkuvyKSbfjoH/2OcSQOu1kJ20ndjhgY2yNChm7gd\ntU7TEBbB0TsLeazkrrLtKvrpW5+CRe07ZAG9HOtp3DikwAyrhSxhlYgVsQDhgB8q\nG0tYiZtQ88YyYrncCQ4hwknrcWXVW9bK3V4ZauxzPv3ADSloyR9tMURw5iHCIeL5\nfIw/pLvA3RjPMx4Sfow/bqRCUELua39prGw5Tv8a2ZRFbj2sgP5j8lUFegyJPQ4z\ntJhe6zZvKOzvIyxHO8llLmdrImsXRL9eqroWGs0VYqe6baQpY6xpSjbYK0J5HYcg\nTO+/u80JI+ROTMHE6unGp5Pgh/xIz6Wd34E0lWL1eOyNfGiPLyRWn1d0yZO5AQ0E\nVdSk1wEIALUycrH2HK9zQYdR/KJo1yJJuaextLWsYYn881yDQo/p06U5vXOZ28lG\nAq/Xs96woVZPbgME6FyQzhf20Z2sbr+5bNo3OcEKaKX3Eo/sWwSJ7bXbGLDxMf4S\netfY1WDC+4rTqE30JuC++nQviPRdCcZf0AEgM6TxVhYEMVYwV787YO1IH62EBICM\nSkIONOfnusNZ4Skgjq9OzakOOpROZ4tki5cH/5oSDgdcaGPy1CFDpL9fG6er2zzk\nsw3qCbraqZrrlgpinWcAduiao67U/dV18O6OjYzrt33fTKZ0+bXhk1h1gloC21MQ\nya0CXlnfR/FOQhvuK0RlbR3cMfhZQscAEQEAAYkBHwQYAQIACQUCVdSk1wIbDAAK\nCRCTUJ5Lr8ikm8+QB/4uE+AlvFQFh9W8koPdfk7CJF7wdgZZ2NDtktvLL71WuMK8\nPOmf9f5JtcLCX4iJxGzcWogAR5ed20NgUoHUg7jn9Xm3fvP+kiqL6WqPhjazd89h\nk06v9hPE65kp4wb0fQqDrtWfP1lFGuh77rQgISt3Y4QutDl49vXS183JAfGPxFxx\n8FgGcfNwL2LVObvqCA0WLqeIrQVbniBPFGocE3yA/0W9BB/xtolpKfgMMsqGRMeu\n9oIsNxB2oE61OsqjUtGsnKQi8k5CZbhJaql4S89vwS+efK0R+mo+0N55b0XxRlCS\nfaURgAcjarQzJnG0hUps2GNO/+nM7UyyJAGfHlh5\n=EdXO\n-----END PGP PUBLIC KEY BLOCK-----\n" ], "delete": [ "DEADBEEF", ] }'
As a response, the modified GPG keys are returned as a map of GpgKeyInfo entities, keyed by ID. Deleted keys are represented by an empty object.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "AFC8A49B": { "fingerprint": "0192 723D 42D1 0C5B 32A6 E1E0 9350 9E4B AFC8 A49B", "user_ids": [ "John Doe \u003cjohn.doe@example.com\u003e" ], "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: BCPG v1.52\n\nmQENBFXUpNcBCACv4paCiyKxZ0EcKy8VaWVNkJlNebRBiyw9WxU85wPOq5Gz/3GT\nRQwKqeY0SxVdQT8VNBw2sBe2m6eqcfZ2iKmesSlbXMe15DA7k8Bg4zEpQ0tXNG1L\nhceZDVQ1Xk06T2sgkunaiPsXi82nwN3UWYtDXxX4is5e6xBNL48Jgz4lbqo6+8D5\nvsVYiYMx4AwRkJyt/oA3IZAtSlY8Yd445nY14VPcnsGRwGWTLyZv9gxKHRUppVhQ\nE3o6ePXKEVgmONnQ4CjqmkGwWZvjMF2EPtAxvQLAuFa8Hqtkq5cgfgVkv/Vrcln4\nnQZVoMm3a3f5ODii2tQzNh6+7LL1bpqAmVEtABEBAAG0H0pvaG4gRG9lIDxqb2hu\nLmRvZUBleGFtcGxlLmNvbT6JATgEEwECACIFAlXUpNcCGwMGCwkIBwMCBhUIAgkK\nCwQWAgMBAh4BAheAAAoJEJNQnkuvyKSbfjoH/2OcSQOu1kJ20ndjhgY2yNChm7gd\ntU7TEBbB0TsLeazkrrLtKvrpW5+CRe07ZAG9HOtp3DikwAyrhSxhlYgVsQDhgB8q\nG0tYiZtQ88YyYrncCQ4hwknrcWXVW9bK3V4ZauxzPv3ADSloyR9tMURw5iHCIeL5\nfIw/pLvA3RjPMx4Sfow/bqRCUELua39prGw5Tv8a2ZRFbj2sgP5j8lUFegyJPQ4z\ntJhe6zZvKOzvIyxHO8llLmdrImsXRL9eqroWGs0VYqe6baQpY6xpSjbYK0J5HYcg\nTO+/u80JI+ROTMHE6unGp5Pgh/xIz6Wd34E0lWL1eOyNfGiPLyRWn1d0" "status": "TRUSTED", "problems": [], } "DEADBEEF": {} }
DELETE /accounts/{account-id}/gpgkeys/{gpg-key-id}
Deletes a GPG key of a user.
Request.
DELETE /accounts/self/gpgkeys/AFC8A49B HTTP/1.0
Response.
HTTP/1.1 204 No Content
GET /accounts/{account-id}/capabilities
Returns the global capabilities that are enabled for the specified user.
If the global capabilities for the calling user should be listed, self
can be used as account-id. This can be used by UI tools to discover if administrative features are available to the caller, so they can hide (or show) relevant UI actions.
Request.
GET /accounts/self/capabilities HTTP/1.0
As response the global capabilities of the user are returned as a CapabilityInfo entity.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "queryLimit": { "min": 0, "max": 500 }, "emailReviewers": true }
Administrator that has authenticated with basic authentication:
Request.
GET /a/accounts/self/capabilities HTTP/1.0 Authorization: Basic ABCDECF..
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "administrateServer": true, "queryLimit": { "min": 0, "max": 500 }, "createAccount": true, "createGroup": true, "createProject": true, "emailReviewers": true, "killTask": true, "viewCaches": true, "flushCaches": true, "viewConnections": true, "viewPlugins": true, "viewQueue": true, "runGC": true }
get::/accounts/self/capabilities
To filter the set of global capabilities the q
parameter can be used. Filtering may decrease the response time by avoiding looking at every possible alternative for the caller.
Request.
GET /a/accounts/self/capabilities?q=createAccount&q=createGroup HTTP/1.0 Authorization: Basic ABCDEF...
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "createAccount": true, "createGroup": true }
get::/accounts/self/capabilities?q=createGroup
GET /accounts/{account-id}/capabilities/{capability-id}
Checks if a user has a certain global capability.
Request.
GET /a/accounts/self/capabilities/createGroup HTTP/1.0
If the user has the global capability the string ok
is returned.
Response.
HTTP/1.1 200 OK ok
If the user doesn’t have the global capability the response is “404 Not Found
”.
get::/accounts/self/capabilities/createGroup
GET /accounts/{account-id}/groups/
Lists all groups that contain the specified user as a member.
Request.
GET /a/accounts/self/groups/ HTTP/1.0
As result a list of GroupInfo entries is returned.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "id": "global%3AAnonymous-Users", "url": "#/admin/groups/uuid-global%3AAnonymous-Users", "options": { }, "description": "Any user, signed-in or not", "group_id": 2, "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389" }, { "id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7", "url": "#/admin/groups/uuid-834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7", "options": { "visible_to_all": true, }, "group_id": 6, "owner_id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7" }, { "id": "global%3ARegistered-Users", "url": "#/admin/groups/uuid-global%3ARegistered-Users", "options": { }, "description": "Any signed-in user", "group_id": 3, "owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389" } ]
get::/accounts/self/groups/
GET /accounts/{account-id}/avatar
Retrieves the avatar image of the user.
With the size
option (alias s
) you can specify the preferred size in pixels (height and width).
Request.
GET /a/accounts/john.doe@example.com/avatar?s=20 HTTP/1.0
The response redirects to the URL of the avatar image.
Response.
HTTP/1.1 302 Found Location: https://profiles/avatar/john_doe.jpeg?s=20x20
GET /accounts/{account-id}/avatar.change.url
Retrieves the URL where the user can change the avatar image.
Request.
GET /a/accounts/self/avatar.change.url HTTP/1.0
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: text/plain; charset=UTF-8 https://profiles/pictures/john.doe
GET /accounts/{account-id}/preferences
Retrieves the user’s preferences.
Request.
GET /a/accounts/self/preferences HTTP/1.0
As result the account preferences of the user are returned as a PreferencesInfo entity.
Users may only retrieve the preferences for their own account, unless they are an Administrator or a member of a group that is granted the ModifyAccount capability, in which case they can retrieve the preferences for any account.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "changes_per_page": 25, "show_site_header": true, "use_flash_clipboard": true, "download_command": "CHECKOUT", "date_format": "STD", "time_format": "HHMM_12", "diff_view": "SIDE_BY_SIDE", "size_bar_in_change_table": true, "review_category_strategy": "ABBREV", "mute_common_path_prefixes": true, "publish_comments_on_push": true, "default_base_for_merges": "FIRST_PARENT", "my": [ { "url": "#/dashboard/self", "name": "Changes" }, { "url": "#/q/has:draft", "name": "Draft Comments" }, { "url": "#/q/is:watched+is:open", "name": "Watched Changes" }, { "url": "#/q/is:starred", "name": "Starred Changes" }, { "url": "#/groups/self", "name": "Groups" }, change_table: [] ] }
PUT /accounts/{account-id}/preferences
Sets the user’s preferences.
The new preferences must be provided in the request body as a PreferencesInput entity.
Request.
PUT /a/accounts/self/preferences HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "changes_per_page": 50, "show_site_header": true, "use_flash_clipboard": true, "expand_inline_diffs": true, "download_command": "CHECKOUT", "date_format": "STD", "time_format": "HHMM_12", "size_bar_in_change_table": true, "review_category_strategy": "NAME", "diff_view": "SIDE_BY_SIDE", "mute_common_path_prefixes": true, "my": [ { "url": "#/dashboard/self", "name": "Changes" }, { "url": "#/q/has:draft", "name": "Draft Comments" }, { "url": "#/q/is:watched+is:open", "name": "Watched Changes" }, { "url": "#/q/is:starred", "name": "Starred Changes" }, { "url": "#/groups/self", "name": "Groups" } ], "change_table": [ "Subject", "Owner" ] }
As result the new preferences of the user are returned as a PreferencesInfo entity.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "changes_per_page": 50, "show_site_header": true, "use_flash_clipboard": true, "expand_inline_diffs": true, "download_command": "CHECKOUT", "date_format": "STD", "time_format": "HHMM_12", "size_bar_in_change_table": true, "review_category_strategy": "NAME", "diff_view": "SIDE_BY_SIDE", "publish_comments_on_push": true, "mute_common_path_prefixes": true, "my": [ { "url": "#/dashboard/self", "name": "Changes" }, { "url": "#/q/has:draft", "name": "Draft Comments" }, { "url": "#/q/is:watched+is:open", "name": "Watched Changes" }, { "url": "#/q/is:starred", "name": "Starred Changes" }, { "url": "#/groups/self", "name": "Groups" } ], "change_table": [ "Subject", "Owner" ] }
GET /accounts/{account-id}/preferences.diff
Retrieves the diff preferences of a user.
Request.
GET /a/accounts/self/preferences.diff HTTP/1.0
As result the diff preferences of the user are returned as a DiffPreferencesInfo entity.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "context": 10, "theme": "DEFAULT", "ignore_whitespace": "IGNORE_ALL", "intraline_difference": true, "line_length": 100, "cursor_blink_rate": 500, "show_tabs": true, "show_whitespace_errors": true, "syntax_highlighting": true, "tab_size": 8, "font_size": 12 }
PUT /accounts/{account-id}/preferences.diff
Sets the diff preferences of a user.
The new diff preferences must be provided in the request body as a DiffPreferencesInput entity.
Request.
PUT /a/accounts/self/preferences.diff HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "context": 10, "theme": "ECLIPSE", "ignore_whitespace": "IGNORE_ALL", "intraline_difference": true, "line_length": 100, "cursor_blink_rate": 500, "show_line_endings": true, "show_tabs": true, "show_whitespace_errors": true, "syntax_highlighting": true, "tab_size": 8, "font_size": 12 }
As result the new diff preferences of the user are returned as a DiffPreferencesInfo entity.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' { "context": 10, "theme": "ECLIPSE", "ignore_whitespace": "IGNORE_ALL", "intraline_difference": true, "line_length": 100, "show_line_endings": true, "show_tabs": true, "show_whitespace_errors": true, "syntax_highlighting": true, "tab_size": 8, "font_size": 12 }
GET /accounts/{account-id}/preferences.edit
Retrieves the edit preferences of a user.
Request.
GET /a/accounts/self/preferences.edit HTTP/1.0
As result the edit preferences of the user are returned as a EditPreferencesInfo entity.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json;charset=UTF-8 )]}' { "theme": "ECLIPSE", "key_map_type": "VIM", "tab_size": 4, "line_length": 80, "indent_unit": 2, "cursor_blink_rate": 530, "hide_top_menu": true, "show_whitespace_errors": true, "hide_line_numbers": true, "match_brackets": true, "line_wrapping": false, "indent_with_tabs": false, "auto_close_brackets": true }
PUT /accounts/{account-id}/preferences.edit
Sets the edit preferences of a user.
The new edit preferences must be provided in the request body as a EditPreferencesInfo entity.
Request.
PUT /a/accounts/self/preferences.edit HTTP/1.0 Content-Type: application/json;charset=UTF-8 { "theme": "ECLIPSE", "key_map_type": "VIM", "tab_size": 4, "line_length": 80, "indent_unit": 2, "cursor_blink_rate": 530, "hide_top_menu": true, "show_tabs": true, "show_whitespace_errors": true, "syntax_highlighting": true, "hide_line_numbers": true, "match_brackets": true, "line_wrapping": false, "auto_close_brackets": true }
As result the new edit preferences of the user are returned as a EditPreferencesInfo entity.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json;charset=UTF-8 )]}' { "theme": "ECLIPSE", "key_map_type": "VIM", "tab_size": 4, "line_length": 80, "cursor_blink_rate": 530, "hide_top_menu": true, "show_whitespace_errors": true, "hide_line_numbers": true, "match_brackets": true, "auto_close_brackets": true }
GET /accounts/{account-id}/watched.projects
Retrieves all projects a user is watching.
Request.
GET /a/accounts/self/watched.projects HTTP/1.0
As result the watched projects of the user are returned as a list of ProjectWatchInfo entities. The result is sorted by project name in ascending order.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "project": "Test Project 1", "notify_new_changes": true, "notify_new_patch_sets": true, "notify_all_comments": true, }, { "project": "Test Project 2", "filter": "branch:experimental", "notify_all_comments": true, "notify_submitted_changes": true, "notify_abandoned_changes": true } ]
POST /accounts/{account-id}/watched.projects
Add new projects to watch or update existing watched projects. Projects that are already watched by a user will be updated with the provided configuration. All other projects in the request will be watched using the provided configuration. The posted body can contain ProjectWatchInfo entities. Omitted boolean values will be set to false.
Request.
POST /a/accounts/self/watched.projects HTTP/1.0 Content-Type: application/json;charset=UTF-8 [ { "project": "Test Project 1", "notify_new_changes": true, "notify_new_patch_sets": true, "notify_all_comments": true, } ]
As result the watched projects of the user are returned as a list of ProjectWatchInfo entities. The result is sorted by project name in ascending order.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "project": "Test Project 1", "notify_new_changes": true, "notify_new_patch_sets": true, "notify_all_comments": true, }, { "project": "Test Project 2", "notify_new_changes": true, "notify_new_patch_sets": true, "notify_all_comments": true, } ]
POST /accounts/{account-id}/watched.projects:delete
Projects posted to this endpoint will no longer be watched. The posted body can contain a list of ProjectWatchInfo entities.
Request.
POST /a/accounts/self/watched.projects:delete HTTP/1.0 Content-Type: application/json;charset=UTF-8 [ { "project": "Test Project 1", "filter": "branch:master" } ]
Response.
HTTP/1.1 204 No Content
GET /accounts/{account-id}/external.ids
Retrieves the external ids of a user account.
Request.
GET /a/accounts/self/external.ids HTTP/1.0
As result the external ids of the user are returned as a list of AccountExternalIdInfo entities.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "identity": "username:john", "email": "john.doe@example.com", "trusted": true } ]
POST /accounts/{account-id}/external.ids:delete
Delete a list of external ids for a user account. The target external ids must be provided as a list in the request body.
Only external ids belonging to the caller may be deleted.
Request.
POST /a/accounts/self/external.ids:delete HTTP/1.0 Content-Type: application/json;charset=UTF-8 [ "mailto:john.doe@example.com" ]
Response.
HTTP/1.1 204 No Content
GET /accounts/{account-id}/starred.changes
Gets the changes that were starred with the default star by the identified user account. This URL endpoint is functionally identical to the changes query GET /changes/?q=is:starred
. The result is a list of ChangeInfo entities.
Request.
GET /a/accounts/self/starred.changes
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940", "project": "myProject", "branch": "master", "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940", "subject": "Implementing Feature X", "status": "NEW", "created": "2013-02-01 09:59:32.126000000", "updated": "2013-02-21 11:16:36.775000000", "starred": true, "stars": [ "star" ], "mergeable": true, "submittable": false, "insertions": 145, "deletions": 12, "_number": 3965, "owner": { "name": "John Doe" } } ]
PUT /accounts/{account-id}/starred.changes/{change-id}
Star a change with the default label. Changes starred with the default label are returned for the search query is:starred
or starredby:USER
and automatically notify the user whenever updates are made to the change.
Request.
PUT /a/accounts/self/starred.changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
Response.
HTTP/1.1 204 No Content
DELETE /accounts/{account-id}/starred.changes/{change-id}
Remove the default star label from a change. This stops notifications.
Request.
DELETE /a/accounts/self/starred.changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
Response.
HTTP/1.1 204 No Content
GET /accounts/{account-id}/stars.changes
Gets the changes that were starred with any label by the identified user account. This URL endpoint is functionally identical to the changes query GET /changes/?q=has:stars
. The result is a list of ChangeInfo entities.
Request.
GET /a/accounts/self/stars.changes
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940", "project": "myProject", "branch": "master", "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940", "subject": "Implementing Feature X", "status": "NEW", "created": "2013-02-01 09:59:32.126000000", "updated": "2013-02-21 11:16:36.775000000", "stars": [ "ignore", "risky" ], "mergeable": true, "submittable": false, "insertions": 145, "deletions": 12, "_number": 3965, "owner": { "name": "John Doe" } } ]
GET /accounts/{account-id}/stars.changes/{change-id}
Get star labels from a change.
Request.
GET /a/accounts/self/stars.changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
As response the star labels that the user applied on the change are returned. The labels are lexicographically sorted.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ "blue", "green", "red" ]
POST /accounts/{account-id}/stars.changes/{change-id}
Update star labels on a change. The star labels to be added/removed must be specified in the request body as StarsInput entity. Starred changes are returned for the search query has:stars
.
Request.
POST /a/accounts/self/stars.changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "add": [ "blue", "red" ], "remove": [ "yellow" ] }
As response the star labels that the user applied on the change are returned. The labels are lexicographically sorted.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ "blue", "green", "red" ]
GET /accounts/{account-id}/agreements
Gets a list of the user’s signed contributor agreements.
Request.
GET /a/accounts/self/agreements HTTP/1.0
As response the user’s signed agreements are returned as a list of ContributorAgreementInfo entities.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' [ { "name": "Individual", "description": "If you are going to be contributing code on your own, this is the one you want. You can sign this one online.", "url": "static/cla_individual.html" } ]
PUT /accounts/{account-id}/agreements
Signs a contributor agreement.
The contributor agreement must be provided in the request body as a ContributorAgreementInput.
Request.
PUT /accounts/self/agreements HTTP/1.0 Content-Type: application/json; charset=UTF-8 { "name": "Individual" }
As response the contributor agreement name is returned.
Response.
HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json; charset=UTF-8 )]}' "Individual"
POST /accounts/{account-id}/index
Adds or updates the account in the secondary index.
Request.
POST /accounts/1000096/index HTTP/1.0
Response.
HTTP/1.1 204 No Content
Identifier that uniquely identifies one account.
This can be:
a string of the format “Full Name <email@example.com>”
just the email address (“email@example”)
a full name if it is unique (“Full Name”)
an account ID (“18419”)
a user name (“username”)
self
for the calling user
Identifier of a global capability. Valid values are all field names of the CapabilityInfo entity.
An email address, or preferred
for the preferred email address of the user.
The user name.
The sequence number of the SSH key.
A GPG key identifier, either the 8-character hex key reported by gpg --list-keys
, or the 40-character hex fingerprint (whitespace is ignored) reported by gpg --list-keys --with-fingerprint
.
The AccountDetailInfo
entity contains detailed information about an account.
AccountDetailInfo
has the same fields as AccountInfo. In addition AccountDetailInfo
has the following fields:
The AccountExternalIdInfo
entity contains information for an external id of an account.
The AccountInfo
entity contains information about an account.
The AccountInput
entity contains information for the creation of a new account.
The AccountNameInput
entity contains information for setting a name for an account.
The AccountStatusInput
entity contains information for setting a status for an account.
The CapabilityInfo
entity contains information about the global capabilities of a user.
The ContributorAgreementInfo
entity contains information about a contributor agreement.
The ContributorAgreementInput
entity contains information about a new contributor agreement.
The DiffPreferencesInfo
entity contains information about the diff preferences of a user.
The DiffPreferencesInput
entity contains information for setting the diff preferences of a user. Fields which are not set will not be updated.
The EditPreferencesInfo
entity contains information about the edit preferences of a user.
The EmailInfo
entity contains information about an email address of a user.
The EmailInput
entity contains information for registering a new email address.
The GpgKeyInfo
entity contains information about a GPG public key.
The GpgKeysInput
entity contains information for adding/deleting GPG keys.
The HttpPasswordInput
entity contains information for setting/generating an HTTP password.
The OAuthTokenInfo
entity contains information about an OAuth access token.
The PreferencesInfo
entity contains information about a user’s preferences.
The PreferencesInput
entity contains information for setting the user preferences. Fields which are not set will not be updated.
The QueryLimitInfo
entity contains information about the Query Limit of a user.
The SshKeyInfo
entity contains information about an SSH key of a user.
The StarsInput
entity contains star labels that should be added to or removed from a change.
The UsernameInput
entity contains information for setting the username for an account.
The WatchedProjectsInfo
entity contains information about a project watch for a user.
Part of Gerrit Code Review