Winimy Tech
Winimy Tech

Reputation: 13

how to get a campaign id from marketing api

getCampaigns - this is giving all the campaign id's of an ad account. but is there a way to get/fetch a single campaign id. Because I am working on a project, in which I would like to know whether the ad account is having a particular campaign id or not. with getCampaigns it gives all the campaign id's (25 per call) and paging. in this case, is there a way to find my campaign id present or not?

Upvotes: 0

Views: 1512

Answers (1)

Matteo
Matteo

Reputation: 39370

You can use the filtering options as example:

https://graph.facebook.com/v3.2/act_<account-id>/campaigns?filtering=[{'field':'id','operator':'IN','value':["<campaign-id>"]}]&fields=name,effective_status?access_token=<accesstoken> 

Or simply try to access to the campaign using the objectId:

https://graph.facebook.com/v3.2/<campaign-id>?access_token=<accesstoken>

but in this case, if the user haven't access or the campaign doesn't exists the endpoint return a generic error.

Upvotes: 1

Related Questions