Class: Zernio::AdCreativesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/ad_creatives_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdCreativesApi

Returns a new instance of AdCreativesApi.



19
20
21
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_ad_creative(create_ad_creative_request, opts = {}) ⇒ CreateAdCreative201Response

Create a standalone creative Creates a creative in the library WITHOUT an ad, reusable on the create endpoints via existingCreativeId. Provide exactly one of imageUrl (uploaded server-side), imageHash (from POST /v1/ads/images or the library list), or carouselCards (2-10 hand-built cards). The Page (and linked Instagram account, when present) is resolved from accountId as the story actor.

Parameters:

Returns:



27
28
29
30
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 27

def create_ad_creative(create_ad_creative_request, opts = {})
  data, _status_code, _headers = create_ad_creative_with_http_info(create_ad_creative_request, opts)
  data
end

#create_ad_creative_with_http_info(create_ad_creative_request, opts = {}) ⇒ Array<(CreateAdCreative201Response, Integer, Hash)>

Create a standalone creative Creates a creative in the library WITHOUT an ad, reusable on the create endpoints via `existingCreativeId`. Provide exactly one of `imageUrl` (uploaded server-side), `imageHash` (from POST /v1/ads/images or the library list), or `carouselCards` (2-10 hand-built cards). The Page (and linked Instagram account, when present) is resolved from `accountId` as the story actor.

Parameters:

Returns:

  • (Array<(CreateAdCreative201Response, Integer, Hash)>)

    CreateAdCreative201Response data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 37

def create_ad_creative_with_http_info(create_ad_creative_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.create_ad_creative ...'
  end
  # verify the required parameter 'create_ad_creative_request' is set
  if @api_client.config.client_side_validation && create_ad_creative_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_ad_creative_request' when calling AdCreativesApi.create_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_ad_creative_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateAdCreative201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.create_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#create_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_ad_creative(creative_id, account_id, opts = {}) ⇒ DeleteAdCreative200Response

Delete a creative Deletes a creative from the library. Meta only allows deleting creatives not referenced by any ad — otherwise its 400 surfaces verbatim.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



96
97
98
99
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 96

def delete_ad_creative(creative_id, , opts = {})
  data, _status_code, _headers = delete_ad_creative_with_http_info(creative_id, , opts)
  data
end

#delete_ad_creative_with_http_info(creative_id, account_id, opts = {}) ⇒ Array<(DeleteAdCreative200Response, Integer, Hash)>

Delete a creative Deletes a creative from the library. Meta only allows deleting creatives not referenced by any ad — otherwise its 400 surfaces verbatim.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteAdCreative200Response, Integer, Hash)>)

    DeleteAdCreative200Response data, response status code and response headers



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 107

def delete_ad_creative_with_http_info(creative_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.delete_ad_creative ...'
  end
  # verify the required parameter 'creative_id' is set
  if @api_client.config.client_side_validation && creative_id.nil?
    fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdCreativesApi.delete_ad_creative"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.delete_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteAdCreative200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.delete_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#delete_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_ad_video(video_id, account_id, ad_account_id, opts = {}) ⇒ DeleteAdVideo200Response

Delete an ad video Removes a video from the ad account's video library. Meta's canonical DELETE /{video_id} fails with code 10 / subcode 1363055 for videos uploaded via /act_X/advideos even with ads_management; this endpoint uses the working account-scoped shape DELETE /act_X/advideos?video_id=<id> and returns Meta's {success: true} verbatim. Deleting a video that lives in a different ad account, or that Meta has already removed, returns Meta's error verbatim as a 4xx.

Parameters:

  • video_id (String)

    Meta ad video id (numeric).

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>) that owns the video.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



167
168
169
170
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 167

def delete_ad_video(video_id, , , opts = {})
  data, _status_code, _headers = delete_ad_video_with_http_info(video_id, , , opts)
  data
end

#delete_ad_video_with_http_info(video_id, account_id, ad_account_id, opts = {}) ⇒ Array<(DeleteAdVideo200Response, Integer, Hash)>

Delete an ad video Removes a video from the ad account's video library. Meta's canonical `DELETE /video_id` fails with code 10 / subcode 1363055 for videos uploaded via `/act_X/advideos` even with `ads_management`; this endpoint uses the working account-scoped shape `DELETE /act_X/advideos?video_id=<id>` and returns Meta's `true` verbatim. Deleting a video that lives in a different ad account, or that Meta has already removed, returns Meta's error verbatim as a 4xx.

Parameters:

  • video_id (String)

    Meta ad video id (numeric).

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>) that owns the video.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteAdVideo200Response, Integer, Hash)>)

    DeleteAdVideo200Response data, response status code and response headers



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 179

def delete_ad_video_with_http_info(video_id, , , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.delete_ad_video ...'
  end
  # verify the required parameter 'video_id' is set
  if @api_client.config.client_side_validation && video_id.nil?
    fail ArgumentError, "Missing the required parameter 'video_id' when calling AdCreativesApi.delete_ad_video"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.delete_ad_video"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.delete_ad_video"
  end
  # resource path
  local_var_path = '/v1/ads/videos/{videoId}'.sub('{' + 'videoId' + '}', CGI.escape(video_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteAdVideo200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.delete_ad_video",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#delete_ad_video\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#generate_ad_previews(generate_ad_previews_request, opts = {}) ⇒ GenerateAdPreviews200Response

Render pre-create ad previews Renders how a creative would look per placement BEFORE any ad exists, via Meta's /generatepreviews. Provide exactly one creative source: existingCreativeId or creativeSpec. Each preview is an HTML <iframe> snippet embeddable directly. Unknown formats values return Meta's 400 verbatim.

Parameters:

Returns:



242
243
244
245
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 242

def generate_ad_previews(generate_ad_previews_request, opts = {})
  data, _status_code, _headers = generate_ad_previews_with_http_info(generate_ad_previews_request, opts)
  data
end

#generate_ad_previews_with_http_info(generate_ad_previews_request, opts = {}) ⇒ Array<(GenerateAdPreviews200Response, Integer, Hash)>

Render pre-create ad previews Renders how a creative would look per placement BEFORE any ad exists, via Meta's `/generatepreviews`. Provide exactly one creative source: `existingCreativeId` or `creativeSpec`. Each preview is an HTML `<iframe>` snippet embeddable directly. Unknown `formats` values return Meta's 400 verbatim.

Parameters:

Returns:



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 252

def generate_ad_previews_with_http_info(generate_ad_previews_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.generate_ad_previews ...'
  end
  # verify the required parameter 'generate_ad_previews_request' is set
  if @api_client.config.client_side_validation && generate_ad_previews_request.nil?
    fail ArgumentError, "Missing the required parameter 'generate_ad_previews_request' when calling AdCreativesApi.generate_ad_previews"
  end
  # resource path
  local_var_path = '/v1/ads/preview'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_ad_previews_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GenerateAdPreviews200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.generate_ad_previews",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#generate_ad_previews\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_creative(creative_id, account_id, opts = {}) ⇒ GetAdCreative200Response

Creative details One creative's details, verbatim from Meta. fields is a raw-passthrough override of the default projection.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

Returns:



312
313
314
315
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 312

def get_ad_creative(creative_id, , opts = {})
  data, _status_code, _headers = get_ad_creative_with_http_info(creative_id, , opts)
  data
end

#get_ad_creative_with_http_info(creative_id, account_id, opts = {}) ⇒ Array<(GetAdCreative200Response, Integer, Hash)>

Creative details One creative's details, verbatim from Meta. `fields` is a raw-passthrough override of the default projection.

Parameters:

  • creative_id (String)

    Platform creative id

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

Returns:

  • (Array<(GetAdCreative200Response, Integer, Hash)>)

    GetAdCreative200Response data, response status code and response headers



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 324

def get_ad_creative_with_http_info(creative_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.get_ad_creative ...'
  end
  # verify the required parameter 'creative_id' is set
  if @api_client.config.client_side_validation && creative_id.nil?
    fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdCreativesApi.get_ad_creative"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.get_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdCreative200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.get_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#get_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_media(ad_id, opts = {}) ⇒ GetAdMedia200Response

Direct video and image URLs for an ad Returns the direct signed URLs for every video and image asset used by an ad's live creative, normalised across shapes: single image/video, carousel, Reels/Story (object_story_spec.video_data) and dynamic creative (asset_feed_spec). Video items include Meta's poster thumbnail and the video's Meta id when available. Reads Meta live rather than the stored creative blob because Meta's signed fbcdn URLs carry an oe=<hex> expiration (image_url ~24 h, video source ~12 d). Treat URLs as short-lived — re-fetch this endpoint before serving or downloading assets instead of caching URLs beyond that window.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex) or platform ad id.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



383
384
385
386
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 383

def get_ad_media(ad_id, opts = {})
  data, _status_code, _headers = get_ad_media_with_http_info(ad_id, opts)
  data
end

#get_ad_media_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdMedia200Response, Integer, Hash)>

Direct video and image URLs for an ad Returns the direct signed URLs for every video and image asset used by an ad's live creative, normalised across shapes: single image/video, carousel, Reels/Story (`object_story_spec.video_data`) and dynamic creative (`asset_feed_spec`). Video items include Meta's poster thumbnail and the video's Meta id when available. Reads Meta live rather than the stored creative blob because Meta's signed fbcdn URLs carry an `oe=<hex>` expiration (image_url ~24 h, video source ~12 d). Treat URLs as short-lived — re-fetch this endpoint before serving or downloading assets instead of caching URLs beyond that window.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex) or platform ad id.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetAdMedia200Response, Integer, Hash)>)

    GetAdMedia200Response data, response status code and response headers



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 393

def get_ad_media_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.get_ad_media ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdCreativesApi.get_ad_media"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/media'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdMedia200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.get_ad_media",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#get_ad_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ad_previews(ad_id, opts = {}) ⇒ GetAdPreviews200Response

Render previews of an existing ad Renders an EXISTING ad per placement via Meta's /{ad_id}/previews. Each preview is an HTML <iframe> snippet embeddable directly. Unknown formats values return Meta's 400 verbatim.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :formats (String)

    Comma-separated Meta ad_format values (max 10), one preview per format. Defaults to DESKTOP_FEED_STANDARD.

Returns:



447
448
449
450
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 447

def get_ad_previews(ad_id, opts = {})
  data, _status_code, _headers = get_ad_previews_with_http_info(ad_id, opts)
  data
end

#get_ad_previews_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdPreviews200Response, Integer, Hash)>

Render previews of an existing ad Renders an EXISTING ad per placement via Meta's `/ad_id/previews`. Each preview is an HTML `<iframe>` snippet embeddable directly. Unknown `formats` values return Meta's 400 verbatim.

Parameters:

  • ad_id (String)

    Zernio ad id (24-char hex).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :formats (String)

    Comma-separated Meta ad_format values (max 10), one preview per format. Defaults to DESKTOP_FEED_STANDARD.

Returns:

  • (Array<(GetAdPreviews200Response, Integer, Hash)>)

    GetAdPreviews200Response data, response status code and response headers



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 458

def get_ad_previews_with_http_info(ad_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.get_ad_previews ...'
  end
  # verify the required parameter 'ad_id' is set
  if @api_client.config.client_side_validation && ad_id.nil?
    fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdCreativesApi.get_ad_previews"
  end
  # resource path
  local_var_path = '/v1/ads/{adId}/preview'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'formats'] = opts[:'formats'] if !opts[:'formats'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetAdPreviews200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.get_ad_previews",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#get_ad_previews\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_catalog_product_sets(catalog_id, account_id, opts = {}) ⇒ ListAdCatalogProductSets200Response

List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as promotedObject.productSetId on POST /v1/ads/create with goal: catalog_sales.

Parameters:

  • catalog_id (String)

    Meta product catalog ID (from GET /v1/ads/catalogs)

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



513
514
515
516
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 513

def list_ad_catalog_product_sets(catalog_id, , opts = {})
  data, _status_code, _headers = list_ad_catalog_product_sets_with_http_info(catalog_id, , opts)
  data
end

#list_ad_catalog_product_sets_with_http_info(catalog_id, account_id, opts = {}) ⇒ Array<(ListAdCatalogProductSets200Response, Integer, Hash)>

List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as `promotedObject.productSetId` on POST /v1/ads/create with `goal: catalog_sales`.

Parameters:

  • catalog_id (String)

    Meta product catalog ID (from GET /v1/ads/catalogs)

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 524

def list_ad_catalog_product_sets_with_http_info(catalog_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_catalog_product_sets ...'
  end
  # verify the required parameter 'catalog_id' is set
  if @api_client.config.client_side_validation && catalog_id.nil?
    fail ArgumentError, "Missing the required parameter 'catalog_id' when calling AdCreativesApi.list_ad_catalog_product_sets"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_catalog_product_sets"
  end
  # resource path
  local_var_path = '/v1/ads/catalogs/{catalogId}/product-sets'.sub('{' + 'catalogId' + '}', CGI.escape(catalog_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCatalogProductSets200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_catalog_product_sets",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_catalog_product_sets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_catalogs(account_id, ad_account_id, opts = {}) ⇒ ListAdCatalogs200Response

List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (goal: catalog_sales on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.

Parameters:

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • ad_account_id (String)

    Meta ad account ID (act_...)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



583
584
585
586
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 583

def list_ad_catalogs(, , opts = {})
  data, _status_code, _headers = list_ad_catalogs_with_http_info(, , opts)
  data
end

#list_ad_catalogs_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdCatalogs200Response, Integer, Hash)>

List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (`goal: catalog_sales` on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.

Parameters:

  • account_id (String)

    A facebook, instagram, or metaads social account ID

  • ad_account_id (String)

    Meta ad account ID (act_...)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ListAdCatalogs200Response, Integer, Hash)>)

    ListAdCatalogs200Response data, response status code and response headers



594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 594

def list_ad_catalogs_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_catalogs ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_catalogs"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.list_ad_catalogs"
  end
  # resource path
  local_var_path = '/v1/ads/catalogs'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCatalogs200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_catalogs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_catalogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_creatives(account_id, ad_account_id, opts = {}) ⇒ ListAdCreatives200Response

Creative library Lists the ad account's creative library (Meta's /act_X/adcreatives), rows returned verbatim. The default projection covers id, name, status, object type, thumbnail, object_story_spec / asset_feed_spec and url_tags; fields is a raw-passthrough override. Any creative id here is reusable on the create endpoints via existingCreativeId.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



657
658
659
660
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 657

def list_ad_creatives(, , opts = {})
  data, _status_code, _headers = list_ad_creatives_with_http_info(, , opts)
  data
end

#list_ad_creatives_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdCreatives200Response, Integer, Hash)>

Creative library Lists the ad account's creative library (Meta's `/act_X/adcreatives`), rows returned verbatim. The default projection covers id, name, status, object type, thumbnail, object_story_spec / asset_feed_spec and url_tags; `fields` is a raw-passthrough override. Any creative id here is reusable on the create endpoints via `existingCreativeId`.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

  • (Array<(ListAdCreatives200Response, Integer, Hash)>)

    ListAdCreatives200Response data, response status code and response headers



671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 671

def list_ad_creatives_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_creatives ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_creatives"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.list_ad_creatives"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_creatives, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_creatives, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/creatives'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdCreatives200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_creatives",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_creatives\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_images(account_id, ad_account_id, opts = {}) ⇒ ListAdImages200Response

Ad image library Lists the ad account's image library (Meta's /act_X/adimages), rows returned verbatim. The default projection covers hash, url, name, dimensions and status; fields is a raw-passthrough override. Any hash here is reusable wherever Meta accepts image_hash (e.g. imageHash on POST /v1/ads/creatives).

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



745
746
747
748
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 745

def list_ad_images(, , opts = {})
  data, _status_code, _headers = list_ad_images_with_http_info(, , opts)
  data
end

#list_ad_images_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdImages200Response, Integer, Hash)>

Ad image library Lists the ad account's image library (Meta's `/act_X/adimages`), rows returned verbatim. The default projection covers hash, url, name, dimensions and status; `fields` is a raw-passthrough override. Any `hash` here is reusable wherever Meta accepts `image_hash` (e.g. `imageHash` on POST /v1/ads/creatives).

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

  • (Array<(ListAdImages200Response, Integer, Hash)>)

    ListAdImages200Response data, response status code and response headers



759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 759

def list_ad_images_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_images ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_images"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.list_ad_images"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_images, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_images, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/images'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdImages200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_images",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_ad_videos(account_id, ad_account_id, opts = {}) ⇒ ListAdVideos200Response

Ad video library Lists the ad account's video library (Meta's /act_X/advideos), rows returned verbatim. The default projection covers id, title, status, poster frames, length and source (the playable MP4); fields is a raw-passthrough override. Any id here is reusable as video.id on the create endpoints, so N ads that differ only in copy share one upload. source lets you PLAY a video before picking it, which a poster frame alone can't settle when several videos share a first frame. It is a signed CDN URL that EXPIRES, so treat it as good for preview at selection time only — never persist it, re-list to get a fresh one. This is the only way to reach a video uploaded OUTSIDE Zernio (Ads Manager, another tool); videos we uploaded also come back as creative.videoId on GET /v1/ads. Meta transcodes asynchronously, so a row is only usable once status.video_status reads ready. Upload a new video via POST /v1/ads/videos, or inline via video.url on POST /v1/ads/create.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:



833
834
835
836
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 833

def list_ad_videos(, , opts = {})
  data, _status_code, _headers = list_ad_videos_with_http_info(, , opts)
  data
end

#list_ad_videos_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdVideos200Response, Integer, Hash)>

Ad video library Lists the ad account's video library (Meta's `/act_X/advideos`), rows returned verbatim. The default projection covers id, title, status, poster frames, length and `source` (the playable MP4); `fields` is a raw-passthrough override. Any `id` here is reusable as `video.id` on the create endpoints, so N ads that differ only in copy share one upload. `source` lets you PLAY a video before picking it, which a poster frame alone can't settle when several videos share a first frame. It is a signed CDN URL that EXPIRES, so treat it as good for preview at selection time only — never persist it, re-list to get a fresh one. This is the only way to reach a video uploaded OUTSIDE Zernio (Ads Manager, another tool); videos we uploaded also come back as `creative.videoId` on GET /v1/ads. Meta transcodes asynchronously, so a row is only usable once `status.video_status` reads `ready`. Upload a new video via POST /v1/ads/videos, or inline via `video.url` on POST /v1/ads/create.

Parameters:

  • account_id (String)

    Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.

  • ad_account_id (String)

    Meta ad account id (act_<n>).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Comma-separated Graph field override (supports nested {} projections).

  • :limit (Integer)

    Rows per page (default to 25)

  • :after (String)

    Cursor from paging.after of the previous page.

Returns:

  • (Array<(ListAdVideos200Response, Integer, Hash)>)

    ListAdVideos200Response data, response status code and response headers



847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 847

def list_ad_videos_with_http_info(, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.list_ad_videos ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCreativesApi.list_ad_videos"
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdCreativesApi.list_ad_videos"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_videos, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCreativesApi.list_ad_videos, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/ads/videos'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'adAccountId'] = 
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListAdVideos200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.list_ad_videos",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#list_ad_videos\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ad_creative(creative_id, update_ad_creative_request, opts = {}) ⇒ UpdateAdCreative200Response

Rename a creative Renames a creative. Creatives are immutable on Meta beyond name — for content changes create a new creative (POST /v1/ads/creatives) and swap it onto the ad (PUT /v1/ads/adId with creative).

Parameters:

  • creative_id (String)

    Platform creative id

  • update_ad_creative_request (UpdateAdCreativeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



918
919
920
921
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 918

def update_ad_creative(creative_id, update_ad_creative_request, opts = {})
  data, _status_code, _headers = update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts)
  data
end

#update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts = {}) ⇒ Array<(UpdateAdCreative200Response, Integer, Hash)>

Rename a creative Renames a creative. Creatives are immutable on Meta beyond `name` — for content changes create a new creative (POST /v1/ads/creatives) and swap it onto the ad (PUT /v1/ads/adId with `creative`).

Parameters:

  • creative_id (String)

    Platform creative id

  • update_ad_creative_request (UpdateAdCreativeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UpdateAdCreative200Response, Integer, Hash)>)

    UpdateAdCreative200Response data, response status code and response headers



929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 929

def update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.update_ad_creative ...'
  end
  # verify the required parameter 'creative_id' is set
  if @api_client.config.client_side_validation && creative_id.nil?
    fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdCreativesApi.update_ad_creative"
  end
  # verify the required parameter 'update_ad_creative_request' is set
  if @api_client.config.client_side_validation && update_ad_creative_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_ad_creative_request' when calling AdCreativesApi.update_ad_creative"
  end
  # resource path
  local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_creative_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAdCreative200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.update_ad_creative",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#update_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_ad_image(upload_ad_image_request, opts = {}) ⇒ UploadAdImage201Response

Upload an ad image from base64 Uploads raw image bytes to the Meta ad account's image library — for callers whose creatives aren't hosted at a public URL. Returns the image hash (Meta's identifier for the asset) and the Meta-hosted url, which can be used directly as imageUrl on the create endpoints. Max 30 MB decoded.

Parameters:

  • upload_ad_image_request (UploadAdImageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



991
992
993
994
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 991

def upload_ad_image(upload_ad_image_request, opts = {})
  data, _status_code, _headers = upload_ad_image_with_http_info(upload_ad_image_request, opts)
  data
end

#upload_ad_image_with_http_info(upload_ad_image_request, opts = {}) ⇒ Array<(UploadAdImage201Response, Integer, Hash)>

Upload an ad image from base64 Uploads raw image bytes to the Meta ad account's image library — for callers whose creatives aren't hosted at a public URL. Returns the image `hash` (Meta's identifier for the asset) and the Meta-hosted `url`, which can be used directly as `imageUrl` on the create endpoints. Max 30 MB decoded.

Parameters:

  • upload_ad_image_request (UploadAdImageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UploadAdImage201Response, Integer, Hash)>)

    UploadAdImage201Response data, response status code and response headers



1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 1001

def upload_ad_image_with_http_info(upload_ad_image_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.upload_ad_image ...'
  end
  # verify the required parameter 'upload_ad_image_request' is set
  if @api_client.config.client_side_validation && upload_ad_image_request.nil?
    fail ArgumentError, "Missing the required parameter 'upload_ad_image_request' when calling AdCreativesApi.upload_ad_image"
  end
  # resource path
  local_var_path = '/v1/ads/images'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(upload_ad_image_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UploadAdImage201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.upload_ad_image",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#upload_ad_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_ad_video(upload_ad_video_request, opts = {}) ⇒ UploadAdVideo201Response

Upload an ad video Standalone ad-video upload (parallel to POST /v1/ads/images), so a video creative can be rendered via POST /v1/ads/preview or attached via video.id on POST /v1/ads/create before an ad exists. Accepts either an https videoUrl we download server-side (SSRF-guarded) or raw videoBase64 bytes; exactly one is required. videoBase64 is capped by Vercel's body limit — around 4.5 MB payload in practice, so larger videos must come via videoUrl. Returns the Meta video.id (reusable wherever video.id is accepted) plus Meta's auto-generated poster URL when available. The endpoint waits until Meta reports the video ready (chunked upload + transcode can take minutes; the handler runs up to 800 s).

Parameters:

  • upload_ad_video_request (UploadAdVideoRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1059
1060
1061
1062
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 1059

def upload_ad_video(upload_ad_video_request, opts = {})
  data, _status_code, _headers = upload_ad_video_with_http_info(upload_ad_video_request, opts)
  data
end

#upload_ad_video_with_http_info(upload_ad_video_request, opts = {}) ⇒ Array<(UploadAdVideo201Response, Integer, Hash)>

Upload an ad video Standalone ad-video upload (parallel to POST /v1/ads/images), so a video creative can be rendered via POST /v1/ads/preview or attached via `video.id` on POST /v1/ads/create before an ad exists. Accepts either an https `videoUrl` we download server-side (SSRF-guarded) or raw `videoBase64` bytes; exactly one is required. `videoBase64` is capped by Vercel's body limit — around 4.5 MB payload in practice, so larger videos must come via `videoUrl`. Returns the Meta `video.id` (reusable wherever `video.id` is accepted) plus Meta's auto-generated poster URL when available. The endpoint waits until Meta reports the video ready (chunked upload + transcode can take minutes; the handler runs up to 800 s).

Parameters:

  • upload_ad_video_request (UploadAdVideoRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UploadAdVideo201Response, Integer, Hash)>)

    UploadAdVideo201Response data, response status code and response headers



1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
# File 'lib/zernio-sdk/api/ad_creatives_api.rb', line 1069

def upload_ad_video_with_http_info(upload_ad_video_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdCreativesApi.upload_ad_video ...'
  end
  # verify the required parameter 'upload_ad_video_request' is set
  if @api_client.config.client_side_validation && upload_ad_video_request.nil?
    fail ArgumentError, "Missing the required parameter 'upload_ad_video_request' when calling AdCreativesApi.upload_ad_video"
  end
  # resource path
  local_var_path = '/v1/ads/videos'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(upload_ad_video_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UploadAdVideo201Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AdCreativesApi.upload_ad_video",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdCreativesApi#upload_ad_video\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end