I am trying to create the creative using the google ad manager API.Following are the details:
Version : v201808
Service : CreativeService
Operation : createCreatives
I tried executing the API using the library code which is provided by google for PHP.
createCreative using googleads-php-lib
Here's my code snippet :
Getting the service by SoapClient :
$creative_Service = $this->getService('CreativeService');
Setting the imageCreative :
$imageCreative = new ImageCreative();
$imageCreative->setName('Image creative #' . uniqid());
$imageCreative->setAdvertiserId(4659289603);
$imageCreative->setDestinationUrl('http://google.com');
$size = new Size();
$size->setWidth(600);
$size->setHeight(315);
$size->setIsAspectRatio(false);
$imageCreative->setSize($size);
$creativeAsset = new CreativeAsset();
$creativeAsset->setFileName(300);
$creativeAsset->setAssetByteArray(<base64StringHere>);
$imageCreative->setPrimaryImageAsset($creativeAsset);
After passing the above imageCreative to API with SoapClient :
$results = $creative_Service->createCreatives([$imageCreative]);
in response I get :
Unmarshalling Error: cvc-type.2: The type definition cannot be abstract for element ns1:creatives.
What I've tried :
- tried using v201811.
- tried using zend soap client library instead of SoapClient.(In this case after executing API it directly throws an exception without any error message).
Can anyone please help me with the issue?
Also I've tried asking on google forum but so far no luck.