Applications API

原文:https://docs.gitlab.com/ee/api/applications.html

Applications API

在 GitLab 10.5 中引入 .

应用程序 API 在以下 OAuth 应用程序上运行:

注意:只有管​​理员用户才能使用 Applications API.

Create an application

通过发布 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

列出所有注册的应用程序.

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

删除特定的应用程序.

如果请求成功,则返回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" 
Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2021-03-27 13:48:25

results matching ""

    No results matching ""