How does one properly filter nested queries with FB Graph Api (Instagram)?

▼魔方 西西 提交于 2019-12-10 12:27:00

问题


I would like to get all media objects that are of type "VIDEO". Here is my query which always returns all media objects regardless of the type:

?fields=media{media_type,insights.metric(reach, impressions)}&filtering=[{field: "media_type", operator: "EQUAL", value: "VIDEO"}]

"media.media_type" is also not working.

Thanks in advance!

output format:

"data": [
  {
    "media_type": "IMAGE",
    "insights": {
      "data": [
        {
          "name": "reach",
          "period": "lifetime",
          "values": [
            {
              "value": 1476
            }
          ],
          "title": "Reichweite",
          "description": "Gesamtanzahl der individuellen Konten, die das Medienobjekt aufgerufen haben",
          "id": "18057498358135767/insights/reach/lifetime"
        },
        {
          "name": "impressions",
          "period": "lifetime",
          "values": [
            {
              "value": 2365
            }
          ],
          "title": "Impressionen",
          "description": "Gesamtanzahl der Aufrufe des Medienobjekts",
          "id": "18057498358135767/insights/impressions/lifetime"
        }
      ]
    },
    "id": "18057498358135767"
  },

回答1:


How about flattening request? so from this:

GET /{ig-user-id}?fields=media

should be the same as

GET /{ig-user-id}/media?fields=media_type,insights.metric(reach, impressions)&filtering=[{'field':'media_type','operator':'IN','value':['VIDEO']}]

and then should be no issue with nested value




回答2:


try using the operator "IN" instead of "EQUAL", and be sure to have a list in the value. That might work.



来源:https://stackoverflow.com/questions/57222780/how-does-one-properly-filter-nested-queries-with-fb-graph-api-instagram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!