BILLING_ACCOUNT_IDS를 청구 계정 ID로 바꿉니다. 이 값은 쉼표로 구분된 청구 계정 ID 목록일 수 있습니다. 예를 들면 XXXXXX-XXXXXX-XXXXXX,XXXXXX-XXXXXX-XXXXXX입니다.
DATASET를 현재 프로젝트의 대상 BigQuery 데이터 세트 ID로 바꿉니다. 예를 들면 company_carbon_report입니다.
전송 구성이 생성되면 이후 모든 달에 대해 익월 15일에 탄소 데이터를 자동으로 내보냅니다. 이전 데이터를 내보내려면 아래를 참조하세요.
REST API를 사용하여 이전 데이터 백필 실행
기존 전송 구성(위 참조)에 대해 기존 탄소 데이터를 내보내려면 전송 구성에 대해 백필을 요청해야 합니다.
백필을 만들려면 이전 단계에서 만든 전송에 대한 식별자(예: projects/0000000000000/locations/us/transferConfigs/00000000-0000-0000-0000-000000000000) 및 다음 페이로드를 사용해서 transferConfigs.startManualRuns 엔드포인트에 POST 요청을 전송해야 합니다.
[[["이해하기 쉬움","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)"],[[["\u003cp\u003eCarbon Footprint data can be exported via the BigQuery Data Transfer Service API, despite not having a dedicated public API.\u003c/p\u003e\n"],["\u003cp\u003eYou can create a carbon footprint transfer using the \u003ccode\u003etransferConfigs.create\u003c/code\u003e endpoint in the BigQuery Data Transfer Service API, specifying details like transfer name, billing accounts, and destination dataset.\u003c/p\u003e\n"],["\u003cp\u003eHistorical carbon data can be exported by requesting a backfill on the existing transfer config using the \u003ccode\u003etransferConfigs.startManualRuns\u003c/code\u003e endpoint and defining a start and end time range.\u003c/p\u003e\n"],["\u003cp\u003eOnce exported to BigQuery, you can then use the BigQuery API or libraries to query your carbon footprint data with SQL queries.\u003c/p\u003e\n"]]],[],null,["# Export and read your carbon footprint using an API\n==================================================\n\nCarbon Footprint does not have a dedicated public API.\nHowever, you can export your carbon footprint via the BigQuery Data Transfer Service API\nand then query the data using the BigQuery API.\n\nUsing the BigQuery Data Transfer Service API\n--------------------------------------------\n\nTo call the BigQuery Data Transfer Service API, you can use the provided\n[client libraries](/bigquery/docs/reference/datatransfer/libraries) or call the\n[REST API](/bigquery/docs/reference/datatransfer/rest) directly.\n\nThe documentation below describes how to create Carbon Footprint\ntransfer configs and backfills using the REST API. However, for\nconvenience you may prefer to make the equivalent API calls using the client\nlibrary in your language of choice.\n\nCreate an export via REST API\n-----------------------------\n\nCall the [`transferConfigs.create` endpoint](/bigquery-transfer/docs/reference/datatransfer/rest/v1/projects.locations.transferConfigs/create)\nof the BigQuery Data Transfer Service API to create a transfer, using the following\npayload: \n\n {\n \"dataSourceId\": \"61cede5a-0000-2440-ad42-883d24f8f7b8\",\n \"displayName\": \"\u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e\",\n \"params\": {\n \"billing_accounts\": \"\u003cvar translate=\"no\"\u003eBILLING_ACCOUNT_IDS\u003c/var\u003e\"\n },\n \"destinationDatasetId\": \"\u003cvar translate=\"no\"\u003eDATASET\u003c/var\u003e\"\n }\n\nReplace:\n\n- \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e with your transfer config name. For example: \"Company Carbon Report\"\n- \u003cvar translate=\"no\"\u003eBILLING_ACCOUNT_IDS\u003c/var\u003e with your billing account ID. This value can be a comma-separated list of billing account IDs. For example: `XXXXXX-XXXXXX-XXXXXX,XXXXXX-XXXXXX-XXXXXX`\n- \u003cvar translate=\"no\"\u003eDATASET\u003c/var\u003e with the destination BigQuery dataset ID in the current project. For example: `company_carbon_report`\n\nOnce the transfer config is created, carbon data will automatically be exported\non the 15th of the month for all future months. To export historical data, see\nbelow.\n\nRun a backfill of historical data via REST API\n----------------------------------------------\n\nTo export historical carbon data for an existing transfer config (see above),\nyou must request a backfill on your transfer config.\n\nTo create a backfill, send a `POST` request to the\n[`transferConfigs.startManualRuns`](/bigquery-transfer/docs/reference/datatransfer/rest/v1/projects.transferConfigs/startManualRuns)\nendpoint, using the identifier of the transfer created in the previous step\n(for example, `projects/0000000000000/locations/us/transferConfigs/00000000-0000-0000-0000-000000000000`)\nand the following payload: \n\n {\n \"requestedTimeRange\": {\n \"startTime\": \"\u003cvar\u003eSTART_TIME\u003c/var\u003e\",\n \"endTime\": \"\u003cvar\u003eEND_TIME\u003c/var\u003e\"\n }\n }\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eSTART_TIME\u003c/var\u003e is a [timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp) that specifies the start time of the range to backfill. For example: `2021-02-15T00:00:00Z`. Note that February 15, 2021 is the earliest date you can specify here, as it contains the January 2021 data.\n- \u003cvar translate=\"no\"\u003eEND_TIME\u003c/var\u003e is a [timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp) that specifies the end time of the range to backfill. For example: `2022-09-15T00:00:00Z`. You can use the current date.\n\nQuery an existing export via API\n--------------------------------\n\nBefore querying the API, write a SQL query that returns the desired data from\nthe exported dataset. You can test the SQL query in the\n[BigQuery console](/bigquery/docs/bigquery-web-ui).\n\nAfter you have [configured an export to BigQuery](/carbon-footprint/docs/export),\nuse the [BigQuery API](https://cloud.google.com/bigquery/docs/reference/rest)\nor [BigQuery libraries](/bigquery/docs/reference/libraries) to run the\nquery.\n\nWhat's next?\n------------\n\n- Read an overview of the [BigQuery APIs and Libraries](/bigquery/docs/reference/libraries-overview)\n- Learn more about [running interactive and batch queries](/bigquery/docs/running-queries)"]]