Facebook marketing api upload video to AdVideo

1.7k views Asked by At

I'm new to FB marketing API. I'm using php to create a function which handles the creation of the adVideo:

 public function getUploadVideo() {
    Api::init($this->appId, $this->appSecret,$this->token);
    $video = new Advideo(null, 'act_' . $this->adAccountId);
    $video->{AdVideoFields::SOURCE} = 'https://s3-us-west 2 .amazonaws.com /unittest-tvpage-com/testsuite/videos/big_buck_bunny.mp4';
    $video->{AdVideoFields::NAME} = 'test_video';
    $x = $video->create();

The video I'm using does not need any permissions and it can be directly downloaded. When I run the function I get the following error message: Type: FacebookAds\Exception\Exception Code: 26 Message: couldn't open file "https://s3-us-west-2.amazonaws.com/unittest-tvpage-com/testsuite/videos/big_buck_bunny.mp4"

Any ideas why the file could not be opened? Thanks

1

There are 1 answers

0
rajthakur On

As per documentation: https://developers.facebook.com/docs/marketing-api/reference/ad-account/advideos

To add the video using the url is file_url not source. The source parameter is used for uploading a file.