Digital Marketing Facebook Marketing API . 1 year ago

Facebook Marketing API Campaign spend_cap field returns inconsistently

Facebook Marketing API Campaign spend_cap field returns inconsistently

0 views   1   0 likes   0 shares Tuteehub forum manpreet 1 answers
_x000D_ _x000D_ I'm trying to pull data for each of my Ad Campaigns from the Facebook Marketing API. In the Ads Insights API there is only a 'spend' field that returns how much of the budget for that campaign has been spent so within the specified date range parameter. This is documented at developers.facebook.com/docs/marketing-api/insights/fields/v2.9 I would like to get the 'spend_cap' field that's specified in the Reference section of the Marketing API located in the link below. One thing I noted was that there are no parameters available to this node, that may be why the spend_cap is not returning. This is documented at developers.facebook.com/docs/marketing-api/reference/ad-campaign-group I am using the following url to request the data. https://graph.facebook.com/v2.9/{act_id}/campaigns?fields=name,spend_cap&access_token={access_token} However, it returns the spend_cap field inconsistently, as shown below. I've only included a couple examples but I'm certain that all my campaigns are set up with spending caps. data:[ { "id": "##############", "name": "name1", "start_time": "2016-06-24T14:47:34-0400", "stop_time": "2016-07-03T14:47:34-0400" }, { "id": "##############", "name": "name2", "spend_cap": "30000", "start_time": "2016-05-16T11:57:10-0400" }, { "id": "##############", "name": "name3", "spend_cap": "15000", "start_time": "2016-05-16T11:44:06-0400", "stop_time": "2017-04-01T00:00:00-0400" }, { "id": "##############", "name": "name4", "start_time": "2016-05-13T15:34:41-0400", "stop_time": "2017-05-13T09:46:44-0400" } ]
tuteehub_quiz
Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

profilepic.png

Tuteehub forum answer Answers (1)


profilepic.png
manpreet Tuteehub forum best answer Best Answer 1 year ago
_x000D_ The spend_cap at the campaign level is an optional field which is why it is only returned for some of the campaigns. In general within the Graph API, if a field contains no data, this field will be omitted from the response. Our SDKs abstract this for you so you can always access a field of an object, regardless of whether it was in the response, so if you're not using one of our SDKs, you'll have to do the same.
0 views   0 shares
Related Tags

AskAnything Ask Anything

Ask Me Anything

ask me anything tuteehub

Hello! How can I assist you today?
Whether you have questions, need information, or just want to chat, feel free to let me know