Invalid field name

57 views
Skip to first unread message

Walter Bodwell

unread,
Sep 16, 2022, 4:18:40 PM9/16/22
to Google Content API for Shopping
I'm trying to run a report against the Content API for Shopping.  For most of the fields described here: https://developers.google.com/shopping-content/reference/rest/v2.1/reports/search, I get: "Error in query: invalid field name"

These fields work:
segments.offer_id
segments.title
segments.brand
metrics.clicks
metrics.impressions
metrics.ctr

These fields give me the error:
segments.categoryL1
segments.categoryL2
segments.categoryL3
segments.categoryL4
segments.categoryL5
segments.productTypeL1
segments.productTypeL2
segments.productTypeL3
segments.productTypeL4
segments.productTypeL5
segments.customLabel0
segments.customLabel1
segments.customLabel2
segments.customLabel0
segments.customLabel0
metrics.orderedItems
metrics.unshippedItems
metrics.shippedItemSalesMicros
metrics.rejectedItems
metrics.itemDaysToShip
metrics.itemFillRate
metrics.returnedItems
metrics.returnsMicros
metrics.returnRate

I get the error both running from my code as well as running the API Explorer on the page.

Here's an example query that fails:
"SELECT segments.offer_id, segments.title, segments.brand, metrics.rejectedItems FROM MerchantPerformanceView WHERE segments.date BETWEEN '2022-08-01' AND '2022-08-31'"

And the full error:
{
  "error": {
    "code": 400,
    "message": "[query] Error in query: invalid field name 'metrics.rejectedItems' in SELECT clause",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "invalid",
        "domain": "global"
      }
    ]
  }
}

Any idea what I might be doing wrong?

Thanks,
Walter

Walter Bodwell

unread,
Sep 17, 2022, 10:10:15 AM9/17/22
to Google Content API for Shopping
Figured it out.  It expects _'s instead of camel case as documented.  So segments.categoryL1 should be  segments.  category_l1, etc.

Walter

Shopping API Forum Advisor

unread,
Sep 19, 2022, 1:21:00 AM9/19/22
to wbod...@ftoptimize.com, google-content-...@googlegroups.com

Hi Walter,

 

This is Ciara from the Content API support team.

 

Glad to know your concern has been resolved. Don't hesitate to reach out for any Content API related questions.

 

Regards,

Google Logo
Ciara
Content API for Shopping Team
 


ref:_00D1U1174p._5004Q2ePY1c:ref
Reply all
Reply to author
Forward
0 new messages