GetPushRule - Query a push rule
Queries a single push rule using OpenAPI.
|
Applicable editions |
Central edition, Region edition |
Endpoint and authorization information
- Obtain an endpoint. Replace {domain} in the API request syntax.
- Obtain a personal access token.
- Obtain the organizationId. This parameter is required only for the Central edition. You can find it on the Basic Information page in the Tennant Management console.
|
Product |
Resource |
Required permission |
|
Code Management |
Push rule |
Read-only |
Request syntax
Central edition
GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/pushRules/{pushRuleId}
Region edition
GET https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/pushRules/{pushRuleId}
Request headers
|
Parameter |
Type |
Required |
Description |
Example |
|
x-yunxiao-token |
string |
Yes |
The personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Position |
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 |
|
pushRuleId |
integer |
path |
Yes |
The push rule ID. |
1 |
Request examples
Central edition
curl -X 'GET' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/pushRules/1' \
-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/2813489或者60de7a6852743a5162b5f957%2FDemoRepo/pushRules/1' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'
Response parameters
|
Parameter |
Type |
Description |
Example |
| - |
object |
|
|
| createdAt |
string |
The time when the rule was created. |
2024-10-05T15:30:45Z |
| id |
integer |
The push rule ID. |
1 |
| ruleInfos |
array |
The rule details. |
|
| - |
object |
|
|
| checkerName |
string |
The rule name. Valid values: `CommitMessageChecker` (commit message), `CommitAuthorEmailChecker` (commit author email), `CommitAuthorChecker` (commit author), `CommitCommitterChecker` (committer), `ForcePushChecker` (force push), `CommitFilesChecker` (file restriction), and `ThirdPartyChecker` (third-party validation). |
CommitMessageChecker |
| checkerType |
string |
The restriction level. `warn`: a warning is returned but the push is allowed. `block`: the push is blocked. |
warn |
| extraMessage |
string |
Valid for commit message, commit email, author, committer, and force push rules. For `CommitMessageChecker`, the regular expression for message validation. For `CommitAuthorEmailChecker`, the regular expression for email validation. For `ForcePushChecker`, set to `disabled` to prevent force pushes. For `CommitAuthorChecker` or `CommitCommitterChecker`, set to `on` to enable the check; omit to skip. For `ThirdPartyChecker`, you can pass an empty string. |
username@example.com |
| fileRuleRegexes |
array[string] |
Applies only to file restriction rules. Specify one or more regular expressions to define restrictions. |
["*.java"] |
| thirdPartyTimeout |
integer |
Applies only to third-party validation rules. Default: 1000 ms. The third-party service should respond within this period. Avoid increasing the timeout. |
1000 |
| thirdPartyUrl |
string |
Applies only to third-party validation rules. The URL of the third-party validation service. If Codeup cannot connect to this service, the push check 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 more information about API error codes, see the Error Code Center.