Help Center/ Cloud Search Service/ API Reference/ Common Parameters/ Obtaining a Project ID and Name
Updated on 2024-10-17 GMT+08:00

Obtaining a Project ID and Name

A project ID or project name is required in some API requests. You need to obtain the project ID and name before calling an API.

Obtaining a Project ID and Name from the Console

  1. Log in to the console.
  2. In the upper right corner of the page, click the username and choose My Credentials from the drop-down list. The API Credentials page is displayed.
  3. In the project list, view the Project ID and Project Name.
    Figure 1 Viewing the project ID and name

Obtaining a Project ID by Calling an API

A project ID can also be obtained by calling a specific API. For details, see Querying Project Information Based on the Specified Criteria.

The API for obtaining a project ID is GET https://{iam-endpoint}/v3/projects. {iam-endpoint} indicates the endpoint of IAM, which can be obtained from Endpoints.For details about how to obtain the IAM endpoint, see Authentication.

The following is an example response. For example, if CSS is deployed in region xxx, the value of name in the response body is xxx. The value of id in projects is the project ID.
{
    "projects": [
        {
            "domain_id": "65382450e8f64ac0870cd180d14exxxx",
            "is_domain": false,
            "parent_id": "65382450e8f64ac0870cd180d14exxxx",
            "name": "xxx",    //Project name, the name of the deployment zone.
            "description": "",
            "links": {
                "next": null,
                "previous": null,
                "self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f897dxxxx"
            },
            "id": "a4a5d4098fb4474fa22cd05f897dxxxx",    //Project ID
            "enabled": true
        }
    ],
    "links": {
        "next": null,
        "previous": null,
        "self": "https://www.example.com/v3/projects"
    }
}