[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Quickstart: Set up Service Usage for a development environment\n\nSet up Service Usage for a development environment\n==================================================\n\nThis page describes how to set up your development environment to use the\nService Usage API.\n\n- For most operational use cases, the simplest way to enable and disable services is to use Google Cloud console.\n- If you need to create scripts, you can use the Google Cloud CLI.\n- If you need to program against the Service Usage API, use one of the [client libraries](/service-usage/docs/libraries).\n- To experiment with the API, you can follow the alternative setup instructions in this guide and use the `curl` command to test the API without setting up a full application development environment.\n\nSet up to call the API directly\n-------------------------------\n\nThis section describes the basic steps necessary to set up your local\nenvironment to experiment with the Service Usage API using the\n`curl` command. It is aimed at developers who need to program against the\nService Usage API.\n| **Note:** You don't need to complete the instructions in this section if you want to list, enable, or disable services using Google Cloud console or the `gcloud` command line interface.\n\n### Enable the Service Usage API\n\nTo use the Service Usage API, you must first enable it in the\nGoogle Cloud project you want to use it for:\n\n1. Go to the Google Cloud console **API Library** page. \n [Go to the API Library page](https://console.cloud.google.com/project/_/apis/library/serviceusage.googleapis.com)\n2. Select the Google Cloud project that you want to use to access the service.\n3. On the API Library page, click **Enable**.\n4. Ensure that your user account has the [Service Usage Admin](https://cloud.google.com/iam/docs/understanding-roles#service-usage-roles) role.\n\n### Test with curl\n\n1. Define a convenient shell alias for calling Google REST APIs:\n\n alias gcurl='curl -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -H \"Content-Type: application/json\"'\n\n2. Set an environment variable `PROJECT_ID` with the identifier of your\n project. This can be the project id or number:\n\n PROJECT_ID=\"my-project-id\"\n\n3. Ensure that you are logged into 'gcloud':\n\n gcloud auth login\n\n4. List the enabled APIs and services in this project:\n\n gcurl \"https://serviceusage.googleapis.com/v1/projects/${PROJECT_ID}/services?filter=state:ENABLED&fields=services.config.title,services.config.name\"\n\n If you see output like this, then your setup is successful: \n\n {\n \"services\": [\n {\n \"config\": {\n \"name\": \"bigquery.googleapis.com\",\n \"title\": \"BigQuery API\"\n }\n },\n {\n \"config\": {\n \"name\": \"bigquerystorage.googleapis.com\",\n \"title\": \"BigQuery Storage API\"\n }\n },\n ...\n\nNext steps\n----------\n\nFollow [Listing Services](/service-usage/docs/list-services) to list the APIs\nand services that are enabled or available in your Google Cloud projects."]]