💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# Applications API > 原文:[https://docs.gitlab.com/ee/api/applications.html](https://docs.gitlab.com/ee/api/applications.html) * [Create an application](#create-an-application) * [List all applications](#list-all-applications) * [Delete an application](#delete-an-application) # Applications API[](#applications-api "Permalink") 在 GitLab 10.5 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8160) . 应用程序 API 在以下 OAuth 应用程序上运行: * [Using GitLab as an authentication provider](../integration/oauth_provider.html). * [Allowing access to GitLab resources on a user’s behalf](oauth2.html). **注意:**只有管​​理员用户才能使用 Applications API. ## Create an application[](#create-an-application "Permalink") 通过发布 JSON 有效负载来创建应用程序. 如果请求成功,则返回`200` . ``` POST /applications ``` Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | 应用程序的名称. | | `redirect_uri` | string | yes | 重定向应用程序的 URI. | | `scopes` | string | yes | 应用范围. | | `confidential` | boolean | no | 该应用程序将在可以对客户机密保密的地方使用. 本机移动应用程序和单页应用程序被认为是非机密的. 如果未提供,则默认为`true` | 请求示例: ``` 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" ``` 响应示例: ``` { "id":1, "application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737", "application_name": "MyApplication", "secret": "ee1dd64b6adc89cf7e2c23099301ccc2c61b441064e9324d963c46902a85ec34", "callback_url": "http://redirect.uri", "confidential": true } ``` ## List all applications[](#list-all-applications "Permalink") 列出所有注册的应用程序. ``` GET /applications ``` 请求示例: ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/applications" ``` 响应示例: ``` [ { "id":1, "application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737", "application_name": "MyApplication", "callback_url": "http://redirect.uri", "confidential": true } ] ``` **注意:**此 API 不会公开`secret`值. ## Delete an application[](#delete-an-application "Permalink") 删除特定的应用程序. 如果请求成功,则返回`204` . ``` DELETE /applications/:id ``` Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer | yes | 应用程序的 ID(不是 application_id). | 请求示例: ``` curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/applications/:id" ```