Contoh panduan memulai

Berikut ini contoh kueri untuk ProductPerformanceView yang menampilkan performa akun Anda selama 30 hari terakhir, yang disegmentasikan menurut marketingMethod dan offerId. Anda dapat mencoba contoh singkat ini untuk memahami Merchant Reports API.

Anda memerlukan peran Performa dan insight untuk mengambil laporan ini. Lihat persyaratan untuk mengetahui detail selengkapnya.

Untuk membuat permintaan, teruskan pernyataan Bahasa Kueri Merchant Center berikut ke metode accounts.reports.search:

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

URL permintaan HTTP

Permintaan terdiri dari POST HTTP ke server Merchant Reports API di URL berikut:

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

Contoh permintaan HTTP lengkap

Berikut adalah contoh lengkap yang menunjukkan definisi laporan yang disertakan dalam permintaan 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'"
}

Berikut adalah contoh respons:

{
  "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"
      }
    }
  ]
}