Open API
# API Service
The service request address is https://api.cnb.cool
.
# Add Access Token
Login CNB
, select Settings
-> Access tokens
-> Add access token
to enter the token creation page.
The required configuration parameters for the token are as follows:
- Token name: The name of the token, used to uniquely identify the token.
- Maturity time: The expiration time of the token; the token becomes unusable after this time.
- Scope: The scope of the token, used to restrict the types of repositories the token can access.
- Authorization scope: The authorization scope of the token, granting the token operational permissions under the account. When accessing the API, the token must meet the authorization scope of the interface to receive a proper response.
- Common scene: Provides quick initialization of token authorization scopes based on common usage scenarios.
Once the creation is complete, you will be able to obtain the token.
# API Document
The API document address is https://api.cnb.cool.
# Calling Method
# Header Information
Authorization
: A string type, this is the standard HTTP authentication header field that carries the personal token for verification. The format is: Bearer ${token}.
# Request Example
Here is an example of a curl request:
curl -X "GET" "https://api.cnb.cool/user/groups?page=1&page_size=10" -H "accept: application/json" \
-H "Authorization: Bearer 1Z1609lSrSizKnLxEWx6WLr3lvA"
Here is the response:
[
{
"id": 1816756487609032700,
"name": "test",
"remark": "test group",
"description": "",
"site": "",
"email": "",
"freeze": false,
"wechat_mp": "hello-world",
"created_at": "2024-07-26T08:44:35Z",
"updated_at": "2024-08-13T07:32:13Z",
"follow_count": 0,
"member_count": 4,
"all_member_count": 4,
"sub_group_count": 5,
"sub_repo_count": 7,
"sub_mission_count": 1,
"all_sub_group_count": 13,
"all_sub_repo_count": 12,
"all_sub_mission_count": 1,
"has_sub_group": true,
"path": "test",
"access_role": "Owner"
}
]