Group Service Account API POST only works with group ids but not with URL encoded path

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

How to reproduce

I want to create a group service account on a self-hosted premium instance.

I have a top-level group named "user" with the group id 512.

The following command works:

curl --request POST --header "PRIVATE-TOKEN: secret-token" "https://git.example.com/api/v4/groups/512/service_accounts"

=> {"id":308,"username":"service_account_group_512_3a8565725ac3330996b803e2cab6d908","name":"Service account user"}

This one does not work:

curl --request POST --header "PRIVATE-TOKEN: secret-token" "https://git.example.com/api/v4/groups/user/service_accounts"

=> {"message":"400 Bad request - User does not have permission to create a service account in this namespace."}

Expected Behavior

Endpoint works with id and url-encoded-path.

Actual Behavior

Endpoint only works with id.

Specifications

Gitlab server version: 17.8.1

Edited by 🤖 GitLab Bot 🤖