1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

cant manage to create ad via ad api - invalid parmeters??

Discussion in 'Facebook API' started by davidTimerman, Jan 7, 2015.

  1. #1
    Hello everyone , hope this question is relevant here , ive just started using the ads api (with the php sdk) , i went through the "getting started" tutorial for creating an ad , everything goes smooth until the ad creation itself ,

    $adgroup = new AdGroup(null, 'act_*********');
    adgroup->create(array(
    AdGroupFields::CREATIVE =>
    array('creative_id' => $creative->id),
    AdGroupFields::NAME => 'My First AdGroup',
    AdGroupFields::CAMPAIGN_ID => ******,
    ));

    at this point i get a response in the form of Uncaught exception 'FacebookAds\Http\Exception\AuthorizationException' with message 'Invalid parameter'

    ive searched and searched for why this might be happening , but nothing comes up ... any thoughts ?
    thanks in advance
    david
     
    davidTimerman, Jan 7, 2015 IP
  2. Gautamm Mehra

    Gautamm Mehra Greenhorn

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #2
    Finally found a solution!

    The Ad Group Status is now a required field. The exception handling errors at the graph API is way better than the SDK which is rather cryptic and leads of hours of wastage of time.

    By adding:

    AdGroupFields::ADGROUP_STATUS => 'ACTIVE'

    while creating the ad group, the operation was successful. You can of course replace ACTIVE with any of the other states such as PAUSED etc.
     
    Gautamm Mehra, Jan 25, 2015 IP
  3. airdomain

    airdomain Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    I have same problem when I create ad!
    With Facebook Ad Api, I can't create ad(group) although I have created the Campaign, AdSet, and AdCreative successfully.
    And I added the parameter, 'status', to my code according to yours, but I have same result. What's wrong???

    ------------ PHP Codes ------------------

    useFacebookAds\Object\AdGroup;useFacebookAds\Object\Fields\AdGroupFields;

    $adgroup =newAdGroup(null, $account->id);
    $adgroup->setData(array(
    AdGroupFields::CREATIVE => array('creative_id'=> $creative->id),
    AdGroupFields::NAME =>'My First AdGroup',
    AdGroupFields::CAMPAIGN_ID => $adset->id,
    AdGroupFields::ADGROUP_STATUS =>'ACTIVE',
    ));

    $adgroup->create();

    I need your advice. please.
     
    airdomain, Feb 23, 2015 IP