Load Facebook adinterests list in a single API call

807 Views Asked by At

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?

1

There are 1 best solutions below

1
bjeavons On

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