Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
a2ac5720
Commit
a2ac5720
authored
Jul 28, 2017
by
AJ Jordan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move API "basic usage" to be more visible
parent
da967803
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
doc/api/README.md
doc/api/README.md
+31
-31
No files found.
doc/api/README.md
View file @
a2ac5720
...
...
@@ -75,6 +75,37 @@ controller-specific endpoints. GraphQL has a number of benefits:
It will co-exist with the current v4 REST API. If we have a v5 API, this should
be a compatibility layer on top of GraphQL.
## Basic usage
API requests should be prefixed with
`api`
and the API version. The API version
is defined in
[
`lib/api.rb`
][
lib-api-url
]
.
For endpoints that require
[
authentication
](
#authentication
)
, you need to pass
a
`private_token`
parameter via query string or header. If passed as a header,
the header name must be
`PRIVATE-TOKEN`
(uppercase and with a dash instead of
an underscore).
Example of a valid API request:
```
GET /projects?private_token=9koXpg98eAheJpvBs5tK
```
Example of a valid API request using cURL and authentication via header:
```
shell
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v4/projects"
```
Example of a valid API request using cURL and authentication via a query string:
```
shell
curl
"https://gitlab.example.com/api/v4/projects?private_token=9koXpg98eAheJpvBs5tK"
```
The API uses JSON to serialize data. You don't need to specify
`.json`
at the
end of an API URL.
## Authentication
Most API requests require authentication via a session cookie or token. For
...
...
@@ -205,37 +236,6 @@ GET /projects?private_token=9koXpg98eAheJpvBs5tK&sudo=23
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
--header
"SUDO: 23"
"https://gitlab.example.com/api/v4/projects"
```
## Basic usage
API requests should be prefixed with
`api`
and the API version. The API version
is defined in
[
`lib/api.rb`
][
lib-api-url
]
.
For endpoints that require
[
authentication
](
#authentication
)
, you need to pass
a
`private_token`
parameter via query string or header. If passed as a header,
the header name must be
`PRIVATE-TOKEN`
(uppercase and with a dash instead of
an underscore).
Example of a valid API request:
```
GET /projects?private_token=9koXpg98eAheJpvBs5tK
```
Example of a valid API request using cURL and authentication via header:
```
shell
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v4/projects"
```
Example of a valid API request using cURL and authentication via a query string:
```
shell
curl
"https://gitlab.example.com/api/v4/projects?private_token=9koXpg98eAheJpvBs5tK"
```
The API uses JSON to serialize data. You don't need to specify
`.json`
at the
end of an API URL.
## Status codes
The API is designed to return different status codes according to context and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment