Method: projects.getMetrics
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
실행 횟수 및 활성 사용자와 같은 스크립트의 측정항목 데이터를 가져옵니다.
HTTP 요청
GET https://script.googleapis.com/v1/projects/{scriptId}/metrics
URL은 gRPC 트랜스코딩 문법을 사용합니다.
경로 매개변수
매개변수 |
scriptId |
string
측정항목을 가져올 스크립트를 나타내는 필수 필드입니다.
|
쿼리 매개변수
매개변수 |
metricsGranularity |
enum (MetricsGranularity )
반환되는 측정항목의 세부사항을 나타내는 필수 필드입니다.
|
metricsFilter |
object (MetricsFilter )
요청에 적용할 필터가 포함된 선택적 필드입니다. 이렇게 하면 반환되는 측정항목의 범위가 필터에 지정된 항목으로 제한됩니다.
|
응답 본문
성공할 경우 응답 본문에 다음 구조의 데이터가 포함됩니다.
지정된 스크립트의 사용 통계가 포함된 리소스이며 요청에 있는 제공된 필터와 마스크를 기반으로 합니다.
필드 |
activeUsers[] |
object (MetricsValue )
활성 사용자 수입니다.
|
totalExecutions[] |
object (MetricsValue )
총 실행 횟수입니다.
|
failedExecutions[] |
object (MetricsValue )
실패한 실행 수입니다.
|
승인 범위
다음 OAuth 범위가 필요합니다.
https://www.googleapis.com/auth/script.metrics
자세한 내용은 OAuth 2.0 개요를 참고하세요.
MetricsGranularity
열거형 |
UNSPECIFIED_GRANULARITY |
측정항목을 쿼리하지 않는 데 사용되는 기본 측정항목 세부사항입니다. |
WEEKLY |
주별 측정항목을 나타냅니다. |
DAILY |
7일 동안의 일일 측정항목을 나타냅니다. |
MetricsFilter
JSON 표현 |
{
"deploymentId": string
} |
필드 |
deploymentId |
string
측정항목을 가져올 특정 배포를 나타내는 선택적 필드입니다.
|
MetricsValue
계산된 실행 횟수를 보유하는 측정항목 값입니다.
JSON 표현 |
{
"value": string,
"startTime": string,
"endTime": string
} |
필드 |
value |
string
계산된 실행 수를 나타냅니다.
|
startTime |
string (Timestamp format)
간격의 시작 시간을 나타내는 필수 필드입니다. RFC3339 UTC 'Zulu' 형식의 타임스탬프입니다(나노초 단위, 소수점 이하 9자리). 예를 들면 "2014-10-02T15:01:23Z" 및 "2014-10-02T15:01:23.045123456Z" 입니다.
|
endTime |
string (Timestamp format)
간격의 종료 시간을 나타내는 필수 필드입니다. RFC3339 UTC 'Zulu' 형식의 타임스탬프입니다(나노초 단위, 소수점 이하 9자리). 예를 들면 "2014-10-02T15:01:23Z" 및 "2014-10-02T15:01:23.045123456Z" 입니다.
|
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eRetrieve usage statistics for Apps Script projects, including active users, total executions, and failed executions.\u003c/p\u003e\n"],["\u003cp\u003eFilter metrics by granularity (daily, weekly) and specific deployments.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/script.metrics\u003c/code\u003e scope.\u003c/p\u003e\n"],["\u003cp\u003eThe API uses a \u003ccode\u003eGET\u003c/code\u003e request with path and query parameters to specify the script and desired metrics.\u003c/p\u003e\n"],["\u003cp\u003eResponse data includes metric values with start and end times for the specified intervals.\u003c/p\u003e\n"]]],[],null,["# Method: projects.getMetrics\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.Metrics.SCHEMA_REPRESENTATION)\n- [Authorization Scopes](#body.aspect)\n- [MetricsGranularity](#MetricsGranularity)\n- [MetricsFilter](#MetricsFilter)\n - [JSON representation](#MetricsFilter.SCHEMA_REPRESENTATION)\n- [MetricsValue](#MetricsValue)\n - [JSON representation](#MetricsValue.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nGet metrics data for scripts, such as number of executions and active users.\n\n### HTTP request\n\n`GET https://script.googleapis.com/v1/projects/{scriptId}/metrics`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|------------|-------------------------------------------------------------------|\n| `scriptId` | `string` Required field indicating the script to get metrics for. |\n\n### Query parameters\n\n| Parameters ||\n|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `metricsGranularity` | `enum (`[MetricsGranularity](/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsGranularity)`)` Required field indicating what granularity of metrics are returned. |\n| `metricsFilter` | `object (`[MetricsFilter](/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsFilter)`)` Optional field containing filters to apply to the request. This limits the scope of the metrics returned to those specified in the filter. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\nResource containing usage stats for a given script, based on the supplied filter and mask present in the request.\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"activeUsers\": [ { object (/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsValue) } ], \"totalExecutions\": [ { object (/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsValue) } ], \"failedExecutions\": [ { object (/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsValue) } ] } ``` |\n\n| Fields ||\n|----------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| `activeUsers[]` | `object (`[MetricsValue](/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsValue)`)` Number of active users. |\n| `totalExecutions[]` | `object (`[MetricsValue](/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsValue)`)` Number of total executions. |\n| `failedExecutions[]` | `object (`[MetricsValue](/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsValue)`)` Number of failed executions. |\n\n### Authorization Scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/script.metrics`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).\n\nMetricsGranularity\n------------------\n\nThe granularity of metric to return data for.\n\n| Enums ||\n|---------------------------|------------------------------------------------------|\n| `UNSPECIFIED_GRANULARITY` | Default metric granularity used to query no metrics. |\n| `WEEKLY` | Represents weekly metrics. |\n| `DAILY` | Represents daily metrics over a period of 7 days. |\n\nMetricsFilter\n-------------\n\nFilter used to reduce the scope of the request.\n\n| JSON representation |\n|------------------------------------|\n| ``` { \"deploymentId\": string } ``` |\n\n| Fields ||\n|----------------|------------------------------------------------------------------------------------|\n| `deploymentId` | `string` Optional field indicating a specific deployment to retrieve metrics from. |\n\nMetricsValue\n------------\n\nMetrics value that holds number of executions counted.\n\n| JSON representation |\n|---------------------------------------------------------------------|\n| ``` { \"value\": string, \"startTime\": string, \"endTime\": string } ``` |\n\n| Fields ||\n|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value` | `string` Indicates the number of executions counted. |\n| `startTime` | `string (`[Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp)` format)` Required field indicating the start time of the interval. A timestamp in RFC3339 UTC \"Zulu\" format, with nanosecond resolution and up to nine fractional digits. Examples: `\"2014-10-02T15:01:23Z\"` and `\"2014-10-02T15:01:23.045123456Z\"`. |\n| `endTime` | `string (`[Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp)` format)` Required field indicating the end time of the interval. A timestamp in RFC3339 UTC \"Zulu\" format, with nanosecond resolution and up to nine fractional digits. Examples: `\"2014-10-02T15:01:23Z\"` and `\"2014-10-02T15:01:23.045123456Z\"`. |"]]