-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
Thanks for writing this node wrapper.
I'm trying to...
I'm trying to create a display ad with an image. Currently I managed to:
- Making budget
- Making a campaign
- Making an ad group
- Uploading an image
- note: ideally I'd just supply a url for the ad image but the docs seem to insist I need to use the
Imagetype which usesbase64data
- note: ideally I'd just supply a url for the ad image but the docs seem to insist I need to use the
- Creating an ad with the image
My current approach is:
const request = require( 'request-promise-native' )
const api = new AdwordsUser( { ... } )
const uploadImage = url => new Promise( async ( resolve, reject ) => {
const mediaService = api.getService('MediaService', 'v201809')
let imgSrc = {
'xsi:type': 'Image',
type: 'IMAGE',
name: 'Generic' + ' - ' + Date.now(),
data: Buffer.from( await request( url ), 'binary' ).toString( 'base64' )
}
mediaService.upload( { media: [ imgSrc ] }, ( error, img ) => error ? reject( error ) : resolve( img.value[0] ) )
} )The unexpected result...
Which results in:
{"faultcode":"soap:Client","faultstring":"[ImageError.INVALID_IMAGE @ media[0].data]","detail":{"ApiExceptionFault":{"message":"[ImageError.INVALID_IMAGE @ media[0].data]","ApplicationException.Type":"ApiException","errors":{"attributes":{"xsi:type":"ImageError"},"fieldPath":"media[0].data","fieldPathElements":[{"field":"media","index":0},{"field":"data"}],"trigger":"","errorString":"ImageError.INVALID_IMAGE","ApiError.Type":"ImageError","reason":"INVALID_IMAGE"}}}}I've tried...
- I looked at Uploading Image for a Display Ad #66 but it didn't solve my issue.
- Send binary data to instead of
base64(error) - using multiple jpeg URLs (confirmed to be valid)
- printed the result of
toString('base64')to my console to manually check validity -
Buffer.fromencoding asbinaryandutf8
If there is any useful information I can share let me know.
Metadata
Metadata
Assignees
Labels
No labels