이 페이지에서는 curl 명령어를 사용하여 Timeseries Insights API를 실험하기 위한 로컬 환경을 설정하는 데 필요한 기본 단계를 설명합니다.
이는 데이터 세트를 만들고 삭제할 수 있는 시계열 통계 데이터 세트 소유자 역할(roles/timeseriesinsights.datasetsOwner)로 프로젝트를 설정하기 위한 가이드입니다.
시작하기 전에
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
[[["이해하기 쉬움","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(UTC)"],[],[],null,["# Setup for Full Access\n\nThis page describes the basic steps necessary to set up your local\nenvironment to experiment with Timeseries Insights API using the\n`curl` command.\n\nThis is a guide to set up a project with the Timeseries Insights\nDataSet Owner role (`roles/timeseriesinsights.datasetsOwner`), which allows you\nto create and delete datasets.\n\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n- [Create or select a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects).\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n - Create a Google Cloud project:\n\n ```\n gcloud projects create PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with a name for the Google Cloud project you are creating.\n - Select the Google Cloud project that you created:\n\n ```\n gcloud config set project PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project name.\n-\n\n\n Enable the Timeseries Insights API:\n\n\n ```bash\n gcloud services enable timeseriesinsights.googleapis.com\n ```\n- Set up authentication:\n\n 1.\n Create the service account:\n\n ```bash\n gcloud iam service-accounts create SERVICE_ACCOUNT_NAME\n ```\n\n\n Replace \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e with a name for the service account.\n 2.\n Grant the `roles/timeseriesinsights.datasetsOwner` IAM\n role to the service account:\n\n ```bash\n gcloud projects add-iam-policy-binding PROJECT_ID --member=\"serviceAccount:\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e@\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.iam.gserviceaccount.com\" --role=roles/timeseriesinsights.datasetsOwner\n ```\n\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e: the name of the service account\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID where you created the service account\n\n | **Note** : The `--role` flag affects which resources the service account can access in your project. You can revoke these roles or grant additional roles later.\n 3.\n Grant the required role to the principal that will create the access tokens for the service\n account.\n\n ```bash\n gcloud iam service-accounts add-iam-policy-binding SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com --member=\"user:\u003cvar translate=\"no\"\u003eUSER_EMAIL\u003c/var\u003e\" --role=roles/iam.serviceAccountTokenCreator\n ```\n\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e: the name of the service account\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID where you created the service account\n - \u003cvar translate=\"no\"\u003eUSER_EMAIL\u003c/var\u003e: the email address for a Google Account\n\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n- [Create or select a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects).\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n - Create a Google Cloud project:\n\n ```\n gcloud projects create PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with a name for the Google Cloud project you are creating.\n - Select the Google Cloud project that you created:\n\n ```\n gcloud config set project PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project name.\n-\n\n\n Enable the Timeseries Insights API:\n\n\n ```bash\n gcloud services enable timeseriesinsights.googleapis.com\n ```\n- Set up authentication:\n\n 1.\n Create the service account:\n\n ```bash\n gcloud iam service-accounts create SERVICE_ACCOUNT_NAME\n ```\n\n\n Replace \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e with a name for the service account.\n 2.\n Grant the `roles/timeseriesinsights.datasetsOwner` IAM\n role to the service account:\n\n ```bash\n gcloud projects add-iam-policy-binding PROJECT_ID --member=\"serviceAccount:\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e@\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e.iam.gserviceaccount.com\" --role=roles/timeseriesinsights.datasetsOwner\n ```\n\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e: the name of the service account\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID where you created the service account\n\n | **Note** : The `--role` flag affects which resources the service account can access in your project. You can revoke these roles or grant additional roles later.\n 3.\n Grant the required role to the principal that will create the access tokens for the service\n account.\n\n ```bash\n gcloud iam service-accounts add-iam-policy-binding SERVICE_ACCOUNT_NAME@PROJECT_ID.iam.gserviceaccount.com --member=\"user:\u003cvar translate=\"no\"\u003eUSER_EMAIL\u003c/var\u003e\" --role=roles/iam.serviceAccountTokenCreator\n ```\n\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e: the name of the service account\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID where you created the service account\n - \u003cvar translate=\"no\"\u003eUSER_EMAIL\u003c/var\u003e: the email address for a Google Account\n\n\u003cbr /\u003e\n\nTest with curl\n--------------\n\n1. Define a convenient shell alias for calling Google REST APIs:\n\n ```bash\n alias gcurl='curl -H \"Authorization: Bearer $(gcloud auth print-access-token --impersonate-service-account=\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL\u003c/var\u003e)\" -H \"Content-Type: application/json\"'\n ```\n2. Set an environment variable `PROJECT_ID` with the identifier of your project:\n\n PROJECT_ID=\"my-project-id\"\n\n3. List the enabled APIs and services in this project:\n\n gcurl \"https://timeseriesinsights.googleapis.com/v1/projects/${PROJECT_ID}/datasets\"\n\n If you do not see an error, then your setup is successful.\n\nNext steps\n----------\n\nFollow [Tutorial](/timeseries-insights/docs/tutorial) to learn about the API."]]