0

I'm trying to get environment info given project id and environment id. I'm following Gitlab doc. Right now I'm able to get all environments by a project id with the following call: http://my_gitlab_url/gitlab/api/v4/projects/27/environments. I get correctly the result:

[
    {
        "id": 46,
        "name": "my_first_env",
        "slug": "my_first_env",
        "external_url": null,
        "project": {
            "id": 27,
            ...
        }
    },
    {
        "id": 47,
        "name": "my_second_env",
        "slug": "my_second_env",
        "external_url": null,
        "project": {
            "id": 27,
            ...
        }
    }
]

Then I want to get a single env info, so using the previous informations I call: http://my_gitlab_url/gitlab/api/v4/projects/27/environments/47 but I receive a 404 error.
That is strange because I got the pair (project, env) from the previous call. Using the env name or slug won't work either.
Also in the env settings page: http://my_gitlab_url/gitlab/my_project/environments/47/edit I only see the name section, no ID. Plus, in this last URL the project ID matches the one I'm using. Am I missing something? Where else can I find the env ID?

esseara
  • 834
  • 5
  • 27
  • 47
  • 1
    I works on my GitLab instance (version: 12.1.4). The ["single environment" endpoint](https://gitlab.com/gitlab-org/gitlab-ce/issues/30157) was added in version 11.11. What is your GitLab version? – sauerburger Aug 08 '19 at 11:29
  • My version is 11.8.0-ee, maybe you're right. I'll ask to update. Thanks for the tip! – esseara Aug 08 '19 at 12:24

1 Answers1

1

Your requests to the API are perfectly fine, you are using the correct environment ID.

However, the "single environment" endpoint was added in version 11.11 and is not yet available in 11.08. You need to update the GitLab server.

sauerburger
  • 4,569
  • 4
  • 31
  • 42