取得服務名稱及設定 ID

如要部署 OpenAPI 文件,請執行 gcloud endpoints services deploy 指令。首次部署 OpenAPI 文件時,gcloud 指令會呼叫 Service Management API,使用您在 OpenAPI 文件 host 欄位中指定的名稱,建立代管服務。Service Management 會自動指派設定 ID,其中包含日期戳記,後接修訂版本編號。例如: 2017-02-13r0

如果您在同一天再次部署服務設定,則 Service Management 會在設定 ID 中遞增修訂版本編號。如果您在另一天再次部署服務設定,則 Service Management 會指派新的日期戳記給設定 ID,並將修訂版本編號重設為 0。

Endpoints 使用 Service Management 來儲存服務設定。Service Management 只會儲存最近的 100 個服務設定。

本頁面說明如何查看服務的名稱與設定 ID。

Google Cloud console

  1. In the Google Cloud console, go to the Endpoints > Services page for your project.

    Go to the Endpoints Services page

  2. If you have more than one API, select an API from the list.
  3. Click the Deployment history tab.
  4. The service name is displayed between the API name and the tabs, near the top-left side of the page. In the Service configuration deployments list, the configuration ID is displayed along with the date and the email address of the principal who deployed the configuration. The Service configuration deployments list displays the latest 100 configuration deployments. The most recent configuration is displayed at the top of the list.

gcloud

  1. Enter the following to display the project IDs for your Google Cloud projects:
    gcloud projects list
  2. Using the applicable project ID from the previous step, set the default project to the one that your API is in:
    gcloud config set project YOUR_PROJECT_ID
  3. Get a list of services in your project:
    gcloud endpoints services list
  4. Using the applicable service name from the previous step, get a list of configuration IDs for the service:
    gcloud endpoints configs list --service=YOUR_SERVICE_NAME

For more information on the preceding commands, see the gcloud reference.

後續步驟