debian-mirror-gitlab/doc/api/applications.md

85 lines
1.9 KiB
Markdown
Raw Normal View History

2018-03-17 18:26:18 +05:30
# Applications API
> [Introduced][ce-8160] in GitLab 10.5
[ce-8160]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8160
2018-12-13 13:39:08 +05:30
Only admin user can use the Applications API.
2018-03-17 18:26:18 +05:30
## Create a application
Create a application by posting a JSON payload.
Returns `200` if the request succeeds.
```
POST /applications
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `name` | string | yes | The name of the application |
| `redirect_uri` | string | yes | The redirect URI of the application |
| `scopes` | string | yes | The scopes of the application |
```bash
2019-02-13 22:33:31 +05:30
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --data "name=MyApplication&redirect_uri=http://redirect.uri&scopes=" https://gitlab.example.com/api/v4/applications
2018-03-17 18:26:18 +05:30
```
Example response:
```json
{
2018-12-13 13:39:08 +05:30
"id":1,
2018-03-17 18:26:18 +05:30
"application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737",
2018-12-13 13:39:08 +05:30
"application_name": "MyApplication",
2018-03-17 18:26:18 +05:30
"secret": "ee1dd64b6adc89cf7e2c23099301ccc2c61b441064e9324d963c46902a85ec34",
"callback_url": "http://redirect.uri"
}
```
2018-12-13 13:39:08 +05:30
## List all applications
List all registered applications.
```
GET /applications
```
```bash
2019-02-13 22:33:31 +05:30
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/applications
2018-12-13 13:39:08 +05:30
```
Example response:
```json
[
{
"id":1,
"application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737",
"application_name": "MyApplication",
"callback_url": "http://redirect.uri"
}
]
```
> Note: the `secret` value will not be exposed by this API.
## Delete an application
Delete a specific application.
Returns `204` if the request succeeds.
```
DELETE /applications/:id
```
Parameters:
- `id` (required) - The id of the application (not the application_id)
```bash
2019-02-13 22:33:31 +05:30
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/applications/:id
2018-12-13 13:39:08 +05:30
```