Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidArgumentException thrown when getting an AdAccounts AdVideos from API v2.3 #83

Closed
samkeen opened this issue Apr 8, 2015 · 1 comment
Assignees
Labels

Comments

@samkeen
Copy link

samkeen commented Apr 8, 2015

/v2.2/act_<account id>/advideos does not return a published field, /v2.3/act_<account id>/advideos does (see example payload below)

We are using facebook-php-ads-sdk v2.3.0

When we call the getAdVideos method (with no fields specified) on FacebookAdAccount we get an InvalidArgumentException with message: "published is not a field of FacebookAds\Object\AdVideo"

This originates at AbstractCrudObject::setData

public function setData(array $data) {
    foreach ($data as $key => $value) {
      $this->{$key} = $value;
    }
    return $this;
  }

Since AdVideo has no published field, when the above loop tries to set $this->published = true; the exception is thrown

Example (truncated) response to https://graph.facebook.com/v2.3/act_<account id>/advideos showing the published field

{
   "data":[
      {
         "id":"10153079548779999",
         "created_time":"2015-02-06T00:47:59+0000",
         "embed_html":"\u003Ciframe src=\"https:\/\/www.facebook.com\/video\/embed?video_id=10153079548779999\" width=\"640\" height=\"360\" frameborder=\"0\">\u003C\/iframe>",
         "format":[
            {
               "embed_html":"\u003Ciframe src=\"https:\/\/www.facebook.com\/video\/embed?video_id=10153079548779999\" width=\"130\" height=\"73\" frameborder=\"0\">\u003C\/iframe>",
               "filter":"130x130",
               "height":73,
               "picture":"https:\/\/fbcdn-vthumb-a.akamaihd.net\/hvthumb-ak-xpa1\/v\/t15.0-10\/p160x160\/10751484_10153079548948234_10153079548779999_45692_1846_b.jpg?oh=cf67559e145d3263bca51c6d65c9e368&oe=559993A4&__gda__=1436187962_3ce5195f0f021bfd58db8327fbc4e7e4",
               "width":130
            },
            {
               "embed_html":"\u003Ciframe src=\"https:\/\/www.facebook.com\/video\/embed?video_id=10153079548779999\" width=\"480\" height=\"270\" frameborder=\"0\">\u003C\/iframe>",
               "filter":"480x480",
               "height":270,
               "picture":"https:\/\/fbcdn-vthumb-a.akamaihd.net\/hvthumb-ak-xpa1\/v\/t15.0-10\/10751484_10153079548948234_10153079548779999_45692_1846_b.jpg?oh=c3322afcd9f3bc19c2f07d0e3dcb426b&oe=559F214F&__gda__=1437469064_d432d6764194e4ad83ffb2cb61c08318",
               "width":480
            },
            {
               "embed_html":"\u003Ciframe src=\"https:\/\/www.facebook.com\/video\/embed?video_id=10153079548779999\" width=\"640\" height=\"360\" frameborder=\"0\">\u003C\/iframe>",
               "filter":"native",
               "height":360,
               "picture":"https:\/\/fbcdn-vthumb-a.akamaihd.net\/hvthumb-ak-xpa1\/v\/t15.0-10\/10751484_10153079548948234_10153079548779999_45692_1846_b.jpg?oh=c3322afcd9f3bc19c2f07d0e3dcb426b&oe=559F214F&__gda__=1437469064_d432d6764194e4ad83ffb2cb61c08318",
               "width":640
            }
         ],
         "from":{
            "id":"10152896328398234",
            "name":"Bob Smith"
         },
         "icon":"https:\/\/fbstatic-a.akamaihd.net\/rsrc.php\/v2\/yD\/r\/DggDhA4z4tO.gif",
         "name":"foom",
         "picture":"https:\/\/fbcdn-vthumb-a.akamaihd.net\/hvthumb-ak-xpa1\/v\/t15.0-10\/p128x128\/10751484_10153079548948234_10153079548779999_45692_1846_b.jpg?oh=b42d46364120c5870fe441d990bad170&oe=55A7A49F&__gda__=1438055169_0bb3c601a8f7e56145e9b916a615a65a",
         "source":"https:\/\/scontent.xx.fbcdn.net\/hvideo-xpa1\/v\/t43.1792-2\/10921600_755745654516018_992090670_n.mp4?rl=1500&vabr=352&oh=505e56d7b85b24a2854b2c6c46e8287c&oe=552737A4",
         "updated_time":"2015-02-06T00:48:03+0000",
         "published":true
      },
      ...
   ],
   "paging":{
      "cursors":{
         "before":"MTAxNTMwNzk1NDg3NzMyMzQ=",
         "after":"MTAxNTI4OTY5MDk0ODMyMzQ="
      }
   }
}
@paulbain
Copy link
Contributor

paulbain commented Apr 9, 2015

published isn't a documented field of an AdVideo right now which is why it's not included.
See: https://developers.facebook.com/docs/marketing-api/advideo/v2.3

We'll look into this.

@pruno pruno added the bug label May 3, 2015
@pruno pruno self-assigned this May 3, 2015
@pruno pruno closed this as completed in d7545b6 May 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants