I've been looking for a way to make async batch calls from facebook library in the github repository README file and the documentation provided by facebook. The problem I'm having is that I want to create a copy of an adset. The appropiate call to do so is very simple as I'm about to show in the following code:
api = FacebookAdsApi.init([APP_ID],[APP_SECRET],[ACCESS_TOKEN])
parameters = {...}
ad_set = AdSet([id])
ad_set.create_copy(fields,parameters)
This is simple and it works, but as I want to copy all child objects it works only when there are three childs or less. After that it is showing the following error:
`The number of ad objects you are trying to copy at this time is too large. The total number of ads, ad sets, and campaigns to copy at once must be fewer than 3. If you are using regular API mode, please consider calling the API in the async batch so that it can copy many more ad objects, https://developers.facebook.com/docs/graph-api/asynchronous-batch-requests.`
In the documentation it tells you how to make an http request for async batchs. But what I want to know is if there is a way to make async batch calls from facebook-business-sdk and how. I will show you my code right now where I'm using batches, but since they are not async they still just works when there are less than 3 childs.
api = FacebookAdsApi.init([APP_ID],[APP_SECRET],[ACCESS_TOKEN])
parameters = {...}
ad_set = AdSet([id])
api_batch = api.new_batch()
ad_set.create_copy(fields,parameters,batch=api_batch)
api_batch.execute()