Updated on 2023-06-25 GMT+08:00

Creating Private Token Authorization

Function

This API is used to create private token authorization.

URI

POST /v1/{project_id}/git/auths/{repo_type}/personal

Table 1 describes the parameters.

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Tenant's project ID.

repo_type

String

Yes

Repository type.

Value: github, gitlab, or gitee.

Request

Request parameters

Table 2 Request parameters

Parameter

Type

Mandatory

Description

name

String

Yes

Authorization name.

token

String

Yes

Repository token.

host

String

No

Repository address.

Response

Response parameters

Table 3 Response parameters

Parameter

Type

Description

authorization

Object

Authorization structure. For details, see Table 4.

Table 4 authorization parameters

Parameter

Type

Description

name

String

Authorization name.

repo_type

String

Repository type.

Value: github, gitlab, or gitee.

repo_host

String

Repository address.

repo_home

String

Repository homepage.

repo_user

String

Repository username.

avartar

String

Avatar.

token_type

String

Authorization mode.

create_time

Long

Creation time.

update_time

Long

Update time.

status

Integer

Status.

Example

Example request

{
  "name": "string",
  "token": "string",
  "host": "string"
}

Example response

{
  "authorization": {
    "name": "string",
    "repo_type": "string",
    "repo_host": "string",
    "repo_home": "string",
    "repo_user": "string",
    "avartar": "string",
    "token_type": "string",
    "create_time": 0,
    "update_time": 0,
    "status": 0
  }
}

Status Code

Table 5 Status codes

Status Code

Description

200

OK

400

Bad Request

Error Code

Error code must be in the format of SVCSTG.REPO.[Error_ID]. Example: SVCSTG.REPO.0401. See ServiceStage Error Codes.