Exemple de démarrage rapide

Voici un exemple de requête envoyée à la méthode ProductPerformanceView, qui affiche les performances de votre compte au cours des 30 derniers jours, segmentée par marketingMethod et offerId. Essayez cet exemple rapide pour vous familiariser avec l'API Merchant Reports.

Vous devez disposer du rôle Performances et insights pour récupérer ce rapport. Pour en savoir plus, consultez les exigences.

Pour envoyer la requête, transmettez cette instruction de langage de requête Merchant Center à la méthode accounts.reports.search:

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

URL de la requête HTTP

La requête consiste en une requête HTTP POST adressée au serveur de l'API Merchant Reports à l'URL suivante:

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

Exemple de requête HTTP complète

Voici un exemple complet illustrant la définition de rapport incluse dans une requête 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'"
}

Voici un exemple de réponse :

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