API requests for project push rules fails when using `NAMESPACE/PROJECT_NAME`
Summary
API requests for a project's push rules fails with a 404 error when the request is made using NAMESPACE/PROJECT_NAME but it succeeds when using the project's ID.
Steps to reproduce
(How one can reproduce the issue - this is very important)
Example Project
https://gitlab.com/ckatanda/api-push-rules-test
What is the current bug behavior?
Sending a GET request to https://gitlab.com/api/v4/projects/ckatanda/api-push-rules-test/push_rule?private_token=XXXXXXXX returns:
{
"error": "404 Not Found"
}
What is the expected correct behavior?
The documentation mentions that one can use the project ID or NAMESPACE/PROJECT_NAME when making an API call for getting a project's push rules. Expected output is similar to what using the ID as https://gitlab.com/api/v4/projects/15093746 /push_rule?private_token=XXXXXXXX returns:
{
"id": 7187570,
"project_id": 15093746,
"created_at": "2019-10-30T15:00:09.541Z",
"commit_message_regex": "",
"commit_message_negative_regex": "",
"branch_name_regex": "",
"deny_delete_tag": true,
"member_check": true,
"prevent_secrets": false,
"author_email_regex": "",
"file_name_regex": "",
"max_file_size": 0,
"commit_committer_check": null,
"reject_unsigned_commits": null
}
This happens on self managed GitLab and on GitLab.com
Customer ticket: https://gitlab.zendesk.com/agent/tickets/137164 (Internal access only)