1

Is there a way to load multiple adinterests by IDs in a single API call?

Here's situation: We have multiple adinterests for ads targeting campaign. For example, we are targeting users that are interested in:

  • music (ID=111)
  • arts (ID=222)
  • museums (ID=333)

We are listing all interests to a user, but in the database we store only IDs.

Currently we can only load single interest per request, e.g.:

https://graph.facebook.com/v2.3/111?access_token=___
https://graph.facebook.com/v2.3/222?access_token=___
https://graph.facebook.com/v2.3/333?access_token=___

or

https://graph.facebook.com/v2.3/?access_token=___&type=adinterest&id=111

This works. However, I would like to load all interests in a single call to speed up page load, for example:

https://graph.facebook.com/v2.3/?type=adinterest&id[0]=111&id[1]=222&id[2]=333&access_token=___

This, unfortunatelly, does not work. So, is there any way to load ad interests list by list of supplied IDs?

lubosdz
  • 4,210
  • 2
  • 29
  • 43

1 Answers1

3

You can use the Batch request framework to make a single HTTP request to multiple endpoints. See https://developers.facebook.com/docs/marketing-api/batch-requests

bjeavons
  • 1,123
  • 6
  • 16
  • Thank you for your answer, which pointed me to proper direction. Unfortunatelly, I cannot mark this answer as correct, because it does not exactly answer the question. It was a little tricky to figure out PHP script that finally worked so I posted it into separate answer. – lubosdz Apr 14 '15 at 12:08