Introduzione all'API Service Management

In questa pagina viene descritto come configurare l'ambiente di sviluppo per utilizzarlo l'API Service Management. L'approccio più semplice all'utilizzo l'API Service Management (oltre al semplice utilizzo Console Google Cloud UI web) e il nostro consiglio per la maggior parte dei casi d'uso operativi è tramite gcloud interfaccia a riga di comando. Se devi programmare in base all'API Service Management, ti consigliamo puoi utilizzare uno dei nostri librerie client. Per eseguire esperimenti con l'API, puoi seguire le istruzioni di configurazione alternativa riportate di seguito e utilizzare il comando curl per provare l'API senza configurare un ambiente di sviluppo completo delle applicazioni.

Configura con gcloud

  1. Accedi al tuo account Google Cloud. Se non conosci Google Cloud, crea un account per valutare le prestazioni dei nostri prodotti in scenari reali. I nuovi clienti ricevono anche 300 $di crediti gratuiti per l'esecuzione, il test e il deployment dei carichi di lavoro.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Enable the Service Management API.

    Enable the API

  4. Install the Google Cloud CLI.
  5. To initialize the gcloud CLI, run the following command:

    gcloud init
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Enable the Service Management API.

    Enable the API

  8. Install the Google Cloud CLI.
  9. To initialize the gcloud CLI, run the following command:

    gcloud init

Configurazione per chiamare direttamente l'API

Questa sezione descrive i passaggi di base necessari per configurare il tuo per sperimentare l'API Service Management utilizzando Comando curl. È rivolto agli sviluppatori che devono programmare contro l'API Service Management.

Impostazione iniziale

  1. Accedi al tuo account Google Cloud. Se non conosci Google Cloud, crea un account per valutare le prestazioni dei nostri prodotti in scenari reali. I nuovi clienti ricevono anche 300 $di crediti gratuiti per l'esecuzione, il test e il deployment dei carichi di lavoro.
  2. Install the Google Cloud CLI.
  3. To initialize the gcloud CLI, run the following command:

    gcloud init
  4. Create or select a Google Cloud project.

    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  5. Enable the Service Management API:

    gcloud services enable servicemanagement.googleapis.com
  6. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/servicemanagement.admin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="USER_IDENTIFIER" --role=ROLE
    • Replace PROJECT_ID with your project ID.
    • Replace USER_IDENTIFIER with the identifier for your user account. For example, user:myemail@example.com.

    • Replace ROLE with each individual role.
  7. Install the Google Cloud CLI.
  8. To initialize the gcloud CLI, run the following command:

    gcloud init
  9. Create or select a Google Cloud project.

    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  10. Enable the Service Management API:

    gcloud services enable servicemanagement.googleapis.com
  11. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/servicemanagement.admin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="USER_IDENTIFIER" --role=ROLE
    • Replace PROJECT_ID with your project ID.
    • Replace USER_IDENTIFIER with the identifier for your user account. For example, user:myemail@example.com.

    • Replace ROLE with each individual role.

Test con curl

  1. Definisci un comodo alias shell per chiamare le API REST Google:

    $ alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
  2. Prova a elencare i servizi accessibili pubblicamente:

    $ gcurl https://servicemanagement.googleapis.com/v1/services
    

    Se vedi un elenco di servizi, significa che la configurazione è riuscita.

Passaggi successivi

Se crei un servizio gestito e non stai utilizzando Cloud Endpoints:

  1. Consulta Creazione ed eliminazione dei servizi. per creare i servizi gestiti. Questo creerà un servizio gestito di primo livello risorsa.
  2. Consulta la sezione Gestione delle configurazioni dei servizi. per inviare configurazioni del servizio per descrivere le funzionalità usato dal servizio.

  3. Segui le istruzioni riportate in Implementazione delle configurazioni dei servizi per eseguire l'implementazione delle configurazioni dei servizi.