diff options
author | Valery Sizov <valery@gitlab.com> | 2015-01-12 15:30:34 -0800 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-01-12 19:29:06 -0800 |
commit | f07b165ab7b0834eadbe05da81fc167dcc23d59d (patch) | |
tree | 4f058527c976dfc9512d70dc62c3f986912980ab /doc/api/README.md | |
parent | 1c6a1253899219b84cc9cb8b090a3bfbbd19605e (diff) | |
download | gitlab-ce-f07b165ab7b0834eadbe05da81fc167dcc23d59d.tar.gz |
OAuth API documentation update
Diffstat (limited to 'doc/api/README.md')
-rw-r--r-- | doc/api/README.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/api/README.md b/doc/api/README.md index ffe250df3ff..8f919f5257d 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -51,6 +51,24 @@ curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://example.com/api/v3/p The API uses JSON to serialize data. You don't need to specify `.json` at the end of API URL. +## Authentication with OAuth2 token + +Instead of the private_token you can transmit the OAuth2 access token as a header or as a parameter. + +### OAuth2 token (as a parameter) + +``` +curl https://localhost:3000/api/v3/user?access_token=OAUTH-TOKEN +``` + +### OAuth2 token (as a header) + +``` +curl -H "Authorization: Bearer OAUTH-TOKEN" https://localhost:3000/api/v3/user +``` + +Read more about [OAuth2 in GitLab](oauth2.md). + ## Status codes The API is designed to return different status codes according to context and action. In this way if a request results in an error the caller is able to get insight into what went wrong, e.g. status code `400 Bad Request` is returned if a required attribute is missing from the request. The following list gives an overview of how the API functions generally behave. |