Updates an existing push rule for a repository.
Endpoint and authorization information
- Obtain the endpoint: Replace {domain} in the API request syntax.
- Obtain a personal access token.
|
Product |
Resource |
Required permission |
|
Code Management |
Push rules |
Read and write |
Request syntax
Region edition
PUT https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/pushRules/{pushRuleId}
Request headers
|
Parameter |
Type |
Required |
Description |
Example value |
|
x-yunxiao-token |
string |
Yes |
Personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example value |
|
repositoryId |
string |
path |
Yes |
Repository ID or URL-encoded full path. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
pushRuleId |
integer |
path |
Yes |
Push rule ID. |
1 |
| - |
object |
body |
No |
|
|
| ruleInfos |
array |
body |
No |
List of rule information. |
|
| - |
object |
body |
No |
|
|
| checkerName |
string |
body |
No |
Rule name. Valid values: CommitMessageChecker – commit message rule; CommitAuthorEmailChecker – commit email rule; CommitAuthorChecker – commit author check; CommitCommitterChecker – committer check; ForcePushChecker – force push check; CommitFilesChecker – commit file restriction rule; ThirdPartyChecker – third-party validation rule. |
CommitMessageChecker |
| checkerType |
string |
body |
No |
Restriction level: warn – warning only (push allowed); block – push blocked. |
warn |
| extraMessage |
string |
body |
No |
Valid for commit message, commit email, author check, committer check, and force push disable: 1. For commit message rules, pass a regular expression. 2. For commit email rules, pass an email regular expression. 3. To disable force push, pass "disabled". 4. For author checks, pass "on"; omit if not needed. 5. For committer checks, pass "on"; omit if not needed. 6. For third-party validation rules, such as an empty string. |
username@example.com |
| fileRuleRegexes |
array[string] |
body |
No |
Applies only to commit file restrictions. Pass one or more regular expressions. |
["*.java"] |
| thirdPartyTimeout |
integer |
body |
No |
Applies only to third-party validation rules. Default timeout: 1000 ms. Keep third-party service response time under 1 second. Do not increase this value. |
1000 |
| thirdPartyUrl |
string |
body |
No |
Applies only to third-party validation rules. Specifies the third-party validation URL. The call fails if the Codeup backend cannot reach this URL. |
http://example.com/test |
Request examples
Region edition
curl -X 'PUT' \
'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/pushRules/1' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"ruleInfos": [
{
"checkerName": "CommitMessageChecker",
"checkerType": "warn",
"extraMessage": "username@example.com",
"fileRuleRegexes": ["*.java"],
"thirdPartyTimeout": 1000,
"thirdPartyUrl": "http://example.com/test"
}
]
}'
Response parameters
|
Parameter |
Type |
Description |
Example value |
| - |
object |
|
|
| createdAt |
string |
Creation time. |
2024-10-05T15:30:45Z |
| id |
integer |
Primary key ID. |
1 |
| ruleInfos |
array |
List of rule information. |
|
| - |
object |
|
|
| checkerName |
string |
Rule name. Valid values: CommitMessageChecker – commit message rule; CommitAuthorEmailChecker – commit email rule; CommitAuthorChecker – commit author check; CommitCommitterChecker – committer check; ForcePushChecker – force push check; CommitFilesChecker – commit file restriction rule; ThirdPartyChecker – third-party validation rule. |
CommitMessageChecker |
| checkerType |
string |
Restriction level: warn – warning only (push allowed); block – push blocked. |
warn |
| extraMessage |
string |
Valid for commit message, commit email, author check, committer check, and force push disable: 1. For commit message rules, pass a regular expression. 2. For commit email rules, pass an email regular expression. 3. To disable force push, pass "disabled". 4. For author checks, pass "on"; omit if not needed. 5. For committer checks, pass "on"; omit if not needed. 6. For third-party validation rules, such as an empty string. |
username@example.com |
| fileRuleRegexes |
array[string] |
Applies only to commit file restrictions. Pass one or more regular expressions. |
["*.java"] |
| thirdPartyTimeout |
integer |
Applies only to third-party validation rules. Default timeout: 1000 ms. Keep third-party service response time under 1 second. Do not increase this value. |
1000 |
| thirdPartyUrl |
string |
Applies only to third-party validation rules. Specifies the third-party validation URL. The call fails if the Codeup backend cannot reach this URL. |
http://example.com/test |
| updatedAt |
string |
Update time. |
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 Error Code Center.