Facebook Marketing API Campaign spend_cap field returns inconsistently

Digital Marketing Facebook Marketing API 2 months ago

0 1 0 0 1 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_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" } ]

Posted on 27 Aug 2024, this text provides information on Facebook Marketing API related to Digital Marketing. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years 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.

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.