Search code examples
facebookadsinstagram-apifacebook-ads-api

How to get ad_id in Facebook Ads?


I want to moderate Instagram ads, but I can not access the ad_id. I have done the "http delete request" to enter the ad_id value but I get an error. How can i get the ad_id in facebook ads api?

DELETE REQUEST URL:

https://graph.facebook.com/v2.8/<ID_HASH_STRING>

BODY PARAMETERS:

{
    "ad_id":"number12321435",
    "access_token":"xxxxxxxxxxxx",
    "appsecret_proof":"xxxxxxxxx"
}

RESPONSE:

{
  "error": {
    "message": "(#100) Param ad_id must be a valid Adgroup ID",
    "type": "OAuthException",
    "code": 100,
    "fbtrace_id": "CAwgnuVEWYl"
  }
}

DOCS: https://developers.facebook.com/docs/marketing-api/guides/instagramads/ad_creative/v2.9 (under "Post Moderation").

Thanks.


Solution

  • I solved this problem!

    You must follow this order to get ad_id and remove comment successfully;

    1. act_id/ads // this end-point gives you id = ad_id which is required to delete a comment or create a comment.If you want to get comments belongs to this ad_id follow order. Assume that id value is '011011011'
    2. ad_id/adcreatives // if you use this endpoint with fileds=effective_instagram_story_id you'll get Ad Creative's Feeds with this feed id you'll get comments
    3. effective_instagram_story_id/comments // gives you latest comments pick a comment's id
    4. aWdfY29tbWVudDoxNz**********?ad_id=011011011 // send delete request and then it's working! As you can see that we used '011011011' id in order to delete this comment at first section.