如何使用 Facebook 筛选市场车辆 API

How to filter marketplace vehicles with Facebook API

我正在执行 /vehicles?limit=300&filter=[{"field":"vehicle_id", "value":"106892", "operator": "EQUAL"}] 然后出现错误 (#100) For field 'vehicles': Param filter must be a valid WCA rule.

==== Query
  curl -i -X GET \
   "https://graph.facebook.com/v9.0/{catelog_id}/vehicles?limit=300&filter=%5B%7B%22field%22%3A%22vehicle_id%22%2C%20%22value%22%3A%22106892%22%2C%20%22operator%22%3A%20%22EQUAL%22%7D%5D&access_token=<access token sanitized>"

==== Parameters
- Query Parameters
  {
    "limit": "300",
    "filter": "[{\"field\":\"vehicle_id\", \"value\":\"106892\", \"operator\": \"EQUAL\"}]"
  }
- POST Parameters
  {}
==== Response
  {
    "error": {
      "message": "(#100) For field 'vehicles': Param filter must be a valid WCA rule.",
      "type": "OAuthException",
      "code": 100,
      "fbtrace_id": "xxx"
    }
  }

Facebook 参考号:https://developers.facebook.com/docs/marketing-api/reference/product-catalog/vehicles/。我找不到任何明确的指南应该如何使用此过滤器。

filter field should be a valid JSON-encoded WCA rule expression representing the filter to be applied for the edge. You could find reference for this definition here and hereFilter Rules,也就是 Example Filter Rules 部分)。在你的例子中,应该是这样的:

/vehicles?filter={"vehicle_id":{"eq":"106892"}}