Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite werden die grundlegenden Schritte zum Einrichten Ihrer lokalen Umgebung und zum Testen der Timeseries Insights API mit dem curl-Befehl beschrieben.
In dieser Anleitung erfahren Sie, wie Sie ein Projekt mit der Rolle „Insights-Datensatzzeitachsen-Inhaber“ (roles/timeseriesinsights.datasetsOwner) einrichten, mit der Sie Datasets erstellen und löschen können.
Hinweise
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.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (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."]]