ListPushRules - Query the list of push rules
Queries the list of push rules for a repository. Paging is not supported.
|
Applicable editions |
Central edition, Region edition |
Endpoint and authorization information
- Obtain an endpoint. Use the endpoint to replace {domain} in the API request syntax.
- Obtain a personal access token.
- Obtain the organizationId. This parameter is required only for the Central edition. Go to the Basic Information page in the Organization Management console to obtain the organization ID.
|
Product |
Resource |
Required Permissions |
|
Code Management |
Push rule |
Read-only |
Request syntax
Central edition
GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/pushRules
Region edition
GET https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/pushRules
Request headers
|
Parameter |
Type |
Required |
Description |
Example |
|
x-yunxiao-token |
string |
Yes |
Your personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example |
|
organizationId |
string |
path |
|
The organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
The repository ID or the URL-encoded full path of the repository. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
Request examples
Central edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/pushRules' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Region edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/repositories/2813489or60de7a6852743a5162b5f957%2FDemoRepo/pushRules' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example |
| - |
array |
|
|
| - |
object |
|
|
| createdAt |
string |
The time when the rule was created. |
2024-10-05T15:30:45Z |
| id |
integer |
The primary key ID of the push rule. |
1 |
| ruleInfos |
array |
The list of rule information. |
|
| - |
object |
|
|
| checkerName |
string |
The name of the rule. Valid values are CommitMessageChecker (commit message rule), CommitAuthorEmailChecker (commit email rule), CommitAuthorChecker (commit author check), CommitCommitterChecker (committer check), ForcePushChecker (force push check), CommitFilesChecker (commit file restriction rule), and ThirdPartyChecker (third-party validation rule). |
CommitMessageChecker |
| checkerType |
string |
The restriction level. Valid values are `warn` to display a warning but allow the push, and `block` to reject the push. |
warn |
| extraMessage |
string |
This parameter is effective for the following rules: 1. For commit message rules, pass the regular expression for validation. 2. For commit email rules, pass the regular expression for the email address. 3. To block forced pushes, pass `disabled`. 4. For author check rules, pass `on`. 5. For committer check rules, pass `on`. 6. For third-party validation rules, pass an empty string. |
username@example.com |
| fileRuleRegexes |
array[string] |
This field applies only to commit file restrictions. Pass one or more regular expressions for the restriction. |
["*.java"] |
| thirdPartyTimeout |
integer |
Applies only to third-party validation rules. Default: 1000 ms. The third-party service must respond within this time. Increasing this value is not recommended. |
1000 |
| thirdPartyUrl |
string |
Applies only to third-party validation rules. The URL of the third-party validation service. If the Codeup backend cannot reach this URL, the request fails. |
http://example.com/test |
| updatedAt |
string |
The time when the rule was last updated. |
2024-10-05T15:30:45Z |
Response example
[
{
"createdAt": "2024-10-05T15:30:45Z",
"id": 1,
"ruleInfos": [
{
"checkerName": "CommitMessageChecker",
"checkerType": "warn",
"extraMessage": "username@example.com",
"fileRuleRegexes": ["*.java"],
"thirdPartyTimeout": 1000,
"thirdPartyUrl": "http://example.com/test"
}
],
"updatedAt": "2024-10-05T15:30:45Z"
}
]
Error codes
For API error codes, see the Error Code Center.