דוגמה למתחילים

הנה שאילתה לדוגמה של ProductPerformanceView, שהחזירה את ביצועי החשבון שלך ב-30 הימים האחרונים, בפילוח לפי marketingMethod ו-offerId. תוכלו לנסות את הדוגמה המהירה הזו כדי להכיר את Merchant Reports API.

כדי לאחזר את הדוח הזה, אתם צריכים את התפקיד Performance and Insights (ביצועים ותובנות). לפרטים נוספים, קראו את הדרישות.

כדי לשלוח את הבקשה, צריך להעביר את ההצהרה הבאה בשפת השאילתה של Merchant Center ל-method accounts.reports.search:

SELECT
  marketingMethod,
  offerId,
  impressions,
  clicks,
  clickThroughRate
FROM ProductPerformanceView
WHERE date BETWEEN '2020-11-01' AND '2020-11-30'

כתובת URL של בקשת HTTP

הבקשה מורכבת מ-HTTP POST שנשלח לשרת של Merchant Reports API בכתובת ה-URL הבאה:

https://merchantapi.googleapis.com/reports/v1beta/accounts/parent/reports:search

השלמה של דוגמת בקשת HTTP

לפניכם דוגמה מלאה של הגדרת הדוח שמופיעה בתוך בקשת HTTP POST:

POST /reports/v1beta/accounts/parent/reports:search HTTP/1.1
Host: merchantapi.googleapis.com
User-Agent: curl
Content-Type: application/json
Accept: application/json
Authorization: Bearer

Parameters:
{
  "query" : "SELECT
              marketingMethod,
              offerId,
              impressions,
              clicks,
              clickThroughRate
            FROM ProductPerformanceView
            WHERE date BETWEEN '2020-11-01' AND '2020-11-30'"
}

הנה תגובה לדוגמה:

{
  "results": [
    {
      "productPerformanceView": {
        "marketingMethod": "ADS",
        "offerId": "12345",
        "clicks": "38",
        "impressions": "1038",
        "clickThroughRate": "0.3661"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ADS",
        "offerId": "12346",
        "clicks": "126",
        "impressions": "1126",
        "clickThroughRate": "0.1119"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ORGANIC",
        "offerId": "12346",
        "clicks": "26",
        "impressions": "526",
        "clickThroughRate": "0.0494"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ADS",
        "offerId": "12347",
        "clicks": "227",
        "impressions": "1227",
        "clickThroughRate": "0.1850"
      }
    },
    {
      "productPerformanceView": {
        "marketingMethod": "ORGANIC",
        "offerId": "12347",
        "clicks": "12",
        "impressions": "512",
        "clickThroughRate": "0.0234"
      }
    }
  ]
}