تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
في ما يلي نموذج طلب بحث إلى MerchantPerformanceView يعرض أداء حسابك خلال آخر 30 يومًا، مقسّمًا حسب program وoffer_id. يمكنك تجربة هذا المثال السريع للتعرّف على خدمة Reports.
انقر على تنفيذ لتجربة العيّنة في مستكشف واجهات برمجة التطبيقات. بعد النقر على تنفيذ، عدِّل عنصر نائب معرّف التاجر إلى معرّف التاجر الخاص بك في عنوان URL للطلب. يمكنك تعديل طلب البحث. يجب أن يبقى الاستعلام الكامل على سطر واحد لكي يعمل مع مستكشف واجهة برمجة التطبيقات.
عنوان URL لطلب HTTP
يتألف الطلب من طلب HTTP POST إلى خادم Content API for Shopping على عنوان URL التالي:
في ما يلي مثال كامل يعرض تعريف التقرير أعلاه مضمّنًا في طلب HTTP POST:
POST/v2.1/merchantId/reports/searchHTTP/1.1Host:shoppingcontent.googleapis.comUser-Agent:curlContent-Type:application/jsonAccept:application/jsonAuthorization:Bearer access tokenParameters:{"query":"SELECT segments.program, segments.offer_id, metrics.impressions, metrics.clicks, metrics.ctr FROM MerchantPerformanceView WHERE segments.date BETWEEN '2020-11-01' AND '2020-11-30'"}
تاريخ التعديل الأخير: 2025-08-13 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-13 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Merchant API is the new version of the Content API for Shopping and represents the future of the platform.\u003c/p\u003e\n"],["\u003cp\u003eYou can use the Merchant API to retrieve performance data, such as impressions, clicks, and CTR, segmented by program and offer ID.\u003c/p\u003e\n"],["\u003cp\u003eA sample query is provided to demonstrate how to retrieve performance data for the last 30 days using the \u003ccode\u003eMerchantPerformanceView\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt's recommended to use one of the client libraries instead of directly making HTTP requests to the Content API for Shopping.\u003c/p\u003e\n"]]],["The beta version of the Merchant API, the new Content API for Shopping, is introduced. To use the `Reports` service, users with the Reporting manager role can query the `MerchantPerformanceView` for account performance. A sample query using Merchant Center Query Language is provided to retrieve data on `program`, `offer_id`, `impressions`, `clicks`, and `ctr` between '2020-11-01' and '2020-11-30'. Users can run the sample via the API Explorer, updating the merchant ID and modifying the query.\n"],null,["# Example\n\nHere's a sample query to the `MerchantPerformanceView` that returns the\nperformance of your account over the last 30 days, segmented by `program` and\n`offer_id`. You can try this quick example to get familiar with the `Reports` service.\n\nYou need the [Reporting manager\nrole](//support.google.com/merchants/answer/11935402) to retrieve this report.\n\nTo make the request, pass the following Merchant Center Query\nLanguage statement to the\n[`reports.search`](/shopping-content/reference/rest/v2.1/reports/search)\nmethod: \n\n SELECT\n segments.program,\n segments.offer_id,\n metrics.impressions,\n metrics.clicks,\n metrics.ctr\n FROM MerchantPerformanceView\n WHERE segments.date BETWEEN '2020-11-01' AND '2020-11-30'\n\n[Run](https://developers.google.com/shopping-content/reference/rest/v2.1/reports/search?apix=true&apix_params=%7B%22merchantId%22%3A0%2C%22resource%22%3A%7B%22query%22%3A%22SELECT%20%20segments.program%2C%20%20segments.offer_id%2C%20%20metrics.impressions%2C%20%20metrics.clicks%2C%20%20metrics.ctr%20FROM%20MerchantPerformanceView%20WHERE%20segments.date%20BETWEEN%20%272020-11-01%27%20AND%20%272020-11-30%27%22%7D%7D)\n\nClick **Run** to try the sample in the **API Explorer** . After you click\n**Run** , update the merchant ID placeholder to your own merchant ID in the\nrequest URL. You can modify the query. The full query must remain on one line to\nwork with the **API explorer**.\n| **Note:** This guide shows the underlying HTTP request as a teaching tool, but we recommend that you use one of the [client libraries](/shopping-content/guides/libraries) to submit your requests.\n\nHTTP request URL\n----------------\n\nThe request consists of an HTTP POST to the Content API for Shopping server at\nthe following URL: \n\n```text\nhttps://shoppingcontent.googleapis.com/content/v2.1/merchantId/reports/search\n```\n\nComplete HTTP request sample\n----------------------------\n\nHere is a complete example showing the report definition above enclosed within\nan HTTP POST request: \n\n```http\nPOST /v2.1/\u003cvar class=\"edit\" translate=\"no\"\u003emerchantId\u003c/var\u003e/reports/search HTTP/1.1\nHost: shoppingcontent.googleapis.com\nUser-Agent: curl\nContent-Type: application/json\nAccept: application/json\nAuthorization: Bearer \u003cvar class=\"edit\" translate=\"no\"\u003eaccess token\u003c/var\u003e\n\nParameters:\n{\n \"query\" : \"SELECT segments.program, segments.offer_id, metrics.impressions,\n metrics.clicks, metrics.ctr\n FROM MerchantPerformanceView\n WHERE segments.date BETWEEN '2020-11-01' AND '2020-11-30'\"\n}\n```"]]