简体   繁体   中英

Facebook Marketing API AdCreative

I have a Facebook App and I successfully created a Campaign and Adset with the Graph API.

When I'm trying to create AdCreative I'm getting an error

The code (Python):

from facebook_business.adobjects.adimage import AdImage

image = AdImage(parent_id=ad_account_id)
image[AdImage.Field.filename] = '/content/Asset 1.png'
image.remote_create()

my_creative = my_account.create_ad_creative(
    fields=[
        'object_story_spec'
    ],
    params={
        'object_story_spec': {
            'page_id': my_pageid,
            'link_data': {
                'message': 'This is my message',
                'image_hash': image[AdImage.Field.hash],
                'link': 'https://facebook.com/' + str(my_pageid),
                'caption': 'https://facebook.com',
                'call_to_action': {
                    'type': 'LIKE_PAGE'
                }
            },
        }
    },
)

my_creative

The error I'm getting:

  Status:  400
  Response:
    {
      "error": {
        "message": "Permissions error",
        "type": "OAuthException",
        "code": 200,
        "error_subcode": 1487194,
        "is_transient": false,
        "error_user_title": "Permission Error",
        "error_user_msg": "Either the object you are trying to access is not visible to you or the action you are trying to take is restricted to certain account types.",
        "fbtrace_id": "A0--lOFs6CHzoEAdNunsFMT"
      }
    }

What do I need to do in order to fix this issue?

Thank you

You might have some problems with permissions. Wrong token or you might have no 'ads_management' permission option for your Access Token. https://developers.facebook.com/docs/marketing-api/access

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM