Marketing API Version

AdImage

Fields

creatives, filename, hash, id, url

AdImage.get_hash ()

Returns the image hash to which AdCreative's can refer.

Sample Code

image = AdImage('1505766289694659:e696138d3b4b330cd2be94107ccf4aaf')
image.remote_read()
image_hash = image.get_hash()
print image_hash

AdImage.remote_create (batch, failure, files, params, success, api_version)

Uploads filename and creates the AdImage object from it.

It has same arguments as AbstractCrudObject.remote_create except it does not have the files argument but requires the 'filename' property to be defined.

Name Type Description Required

batch

FacebookAdsApiBatch

A FacebookAdsApiBatch object. If specified, the call will be added to the batch.

No

failure

callback

A callback function which will be called with the FacebookResponse of this call if the call failed.

No

files

map

An optional mapping of file names to binary open file objects. These files will be attached to the request.

No

params

map

A mapping of request parameters where a key is the parameter name and its value is a string or an object which can be JSON-encoded.

No

success

callback

A callback function which will be called with the FacebookResponse of this call if the call succeeded.

No

api_version

string

The version of the API to use.

No

Sample Code

image = AdImage(parent_id='act_1505766289694659')
image[AdImage.Field.filename] = '/tmp/tmp-python-ads-sdk/facebookads/test/test.png'
image.remote_create()
print image

AdImage.remote_create_from_zip (filename, parent_id, api)

Returns object for each image in a zip for an ad's creative

Name Type Description Required

filename

string

The path to a local file on the machine.

Yes

parent_id

string

The ID of the account in which you are creating this object. This value should be 'act_' prepended.

Yes

api

FacebookAdsApi

A FacebookAdsApi instance.

No

Sample Code

images = AdImage.remote_create_from_zip(
    filename='/tmp/tmp-python-ads-sdk/facebookads/test/test.zip',
    parent_id='act_1505766289694659',
)
print images

AdImage.remote_read (batch, failure, fields, params, success, api_version)

Name Type Description Required

batch

FacebookAdsApiBatch

A FacebookAdsApiBatch object. If specified, the call will be added to the batch.

No

failure

callback

A callback function which will be called with the FacebookResponse of this call if the call failed.

No

fields

array

A list of fields to read.

No

params

map

A mapping of request parameters where a key is the parameter name and its value is a string or an object which can be JSON-encoded.

No

success

callback

A callback function which will be called with the FacebookResponse of this call if the call succeeded.

No

api_version

string

The version of the API to use.

No

Sample Code

image = AdImage('1505766289694659:e696138d3b4b330cd2be94107ccf4aaf')
image.remote_read()
print image