Can't create a new project inside a group via API

I have a group called spr-customers. It has the namespace_id 28. This I know, because listing all projects for the group references this namespace_id. I can also query the namespace by looking it up via API. However, listing all namespaces does not return the namespace associated with this group. When I try to create a new project inside the group by providing its namespace_id it still ends up as a personal project.

curl --request GET --header "PRIVATE-TOKEN: $GITLABTOKEN" https://gl.domain.io/api/v4/namespaces/28 | jq

{
  "id": 28,
  "name": "spr-customers",
  "path": "spr-clients",
  "kind": "group",
  "full_path": "spr-clients",
  "parent_id": null,
  "members_count_with_descendants": 3
}

Creating a new project using this namespace still results in a private project inside my namespace

curl --request POST --header "PRIVATE-TOKEN: $GITLABTOKEN" https://gl.domain.io/api/v4/projects?name=foobar&namespace_id=28

curl --request GET --header "PRIVATE-TOKEN: $GITLABTOKEN" https://gl.domain.io/api/v4/projects/83 | jq

{
  "id": 83,
  "description": null,
  "name": "foobar",
  "name_with_namespace": "lari / foobar",
  "path": "foobar",
  "path_with_namespace": "lari/foobar",
  "created_at": "2019-04-29T13:07:39.769Z",
  ...
  "last_activity_at": "2019-04-29T13:07:39.769Z",
  "namespace": {
    "id": 2,
    "name": "lari",
    "path": "lari",
    "kind": "user",
    "full_path": "lari",
    "parent_id": null
  },
...

I’m probably missing something really obvious, but I can’t figure it out. Help would be greatly appreciated.

I solved it. As assumed, general stupidity on my part.

It’s a POST request, you have to pass a json as request body. I was fooled by the fact, that it will accept the repository name as a GET parameter in the url:

curl --request POST --header "PRIVATE-TOKEN: $GITLABTOKEN" -H "Content-Type: application/json" -d '{"name": "foobar", "namespace_id": "28"}' https://gl.domain.io/api/v4/projects

or, in case the repository name is inside an environment variable $NAME

curl --request POST --header "PRIVATE-TOKEN: $GITLABTOKEN" -H "Content-Type: application/json" -d "{\"name\": $NAME, \"namespace_id\": \"28\"}" https://gl.domain.io/api/v4/projects

Make sure you pair and escape all your json ", otherwise it will just die silently.