Method: projects.getMetrics
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
स्क्रिप्ट के लिए मेट्रिक डेटा पाएं, जैसे कि स्क्रिप्ट चलाने की संख्या और सक्रिय उपयोगकर्ता.
एचटीटीपी अनुरोध
GET https://script.googleapis.com/v1/projects/{scriptId}/metrics
यह यूआरएल 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
मेट्रिक के बारे में वह जानकारी जिसके लिए डेटा देना है.
Enums |
UNSPECIFIED_GRANULARITY |
किसी मेट्रिक के बारे में क्वेरी करने के लिए, डिफ़ॉल्ट मेट्रिक के लेवल का इस्तेमाल किया जाता है. |
WEEKLY |
इससे हर हफ़्ते की मेट्रिक दिखती है. |
DAILY |
यह सात दिनों की समयावधि की हर दिन की मेट्रिक दिखाता है. |
MetricsFilter
अनुरोध का दायरा कम करने के लिए इस्तेमाल किया जाने वाला फ़िल्टर.
JSON के काेड में दिखाना |
{
"deploymentId": string
} |
फ़ील्ड |
deploymentId |
string
यह फ़ील्ड ज़रूरी नहीं है. इसमें किसी खास डिप्लॉयमेंट के बारे में बताया गया है, जिससे मेट्रिक फिर से हासिल की जा सकती हैं.
|
MetricsValue
मेट्रिक की वह वैल्यू जिसमें लागू किए जाने की संख्या की गिनती की जाती है.
JSON के काेड में दिखाना |
{
"value": string,
"startTime": string,
"endTime": string
} |
फ़ील्ड |
value |
string
यह गिने गए कि एक्ज़ीक्यूशन की संख्या दिखाता है.
|
startTime |
string (Timestamp format)
इंटरवल शुरू होने का समय बताने वाला ज़रूरी फ़ील्ड. आरएफ़सी3339 यूटीसी "ज़ुलु" में टाइमस्टैंप फ़ॉर्मैट, नैनोसेकंड रिज़ॉल्यूशन और ज़्यादा से ज़्यादा नौ फ़्रैक्शनल अंकों के साथ हो सकता है. उदाहरण: "2014-10-02T15:01:23Z" और "2014-10-02T15:01:23.045123456Z" .
|
endTime |
string (Timestamp format)
इंटरवल खत्म होने का समय बताने वाला ज़रूरी फ़ील्ड. आरएफ़सी3339 यूटीसी "ज़ुलु" में टाइमस्टैंप फ़ॉर्मैट, नैनोसेकंड रिज़ॉल्यूशन और ज़्यादा से ज़्यादा नौ फ़्रैक्शनल अंकों के साथ हो सकता है. उदाहरण: "2014-10-02T15:01:23Z" और "2014-10-02T15:01:23.045123456Z" .
|
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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\"`. |"]]