Class: Zernio::AdCampaignsApi
- Inherits:
-
Object
- Object
- Zernio::AdCampaignsApi
- Defined in:
- lib/zernio-sdk/api/ad_campaigns_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#attach_campaign_assets(campaign_id, attach_campaign_assets_request, opts = {}) ⇒ AttachCampaignAssets201Response
Attach extension assets to a Google Search campaign Attach sitelinks, callouts and/or structured snippets to an already-existing Google Search campaign — the same builders POST /v1/ads/create uses, but without rebuilding the hierarchy.
-
#attach_campaign_assets_with_http_info(campaign_id, attach_campaign_assets_request, opts = {}) ⇒ Array<(AttachCampaignAssets201Response, Integer, Hash)>
Attach extension assets to a Google Search campaign Attach sitelinks, callouts and/or structured snippets to an already-existing Google Search campaign — the same builders POST /v1/ads/create uses, but without rebuilding the hierarchy.
-
#boost_post(boost_post_request, opts = {}) ⇒ UpdateAd200Response
Boost post as ad Creates a paid ad from an existing published post, keeping the post's engagement.
-
#boost_post_with_http_info(boost_post_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>
Boost post as ad Creates a paid ad from an existing published post, keeping the post's engagement.
-
#bulk_update_ad_campaign_status(bulk_update_ad_campaign_status_request, opts = {}) ⇒ BulkUpdateAdCampaignStatus200Response
Pause or resume many campaigns Process up to 50 campaigns in one call.
-
#bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts = {}) ⇒ Array<(BulkUpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume many campaigns Process up to 50 campaigns in one call.
-
#create_ad_campaign(create_ad_campaign_request, opts = {}) ⇒ CreateAdCampaign201Response
Create a standalone campaign Creates a campaign WITHOUT its first ad set / ad (the ODAX shell only).
-
#create_ad_campaign_with_http_info(create_ad_campaign_request, opts = {}) ⇒ Array<(CreateAdCampaign201Response, Integer, Hash)>
Create a standalone campaign Creates a campaign WITHOUT its first ad set / ad (the ODAX shell only).
-
#create_standalone_ad(create_standalone_ad_request, opts = {}) ⇒ CreateStandaloneAd200Response
Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, LinkedIn, and OpenAI Ads (ChatGPT Ads).
-
#create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) ⇒ Array<(CreateStandaloneAd200Response, Integer, Hash)>
Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, LinkedIn, and OpenAI Ads (ChatGPT Ads).
-
#delete_ad(ad_id, opts = {}) ⇒ DeleteAccountGroup200Response
Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database.
-
#delete_ad_campaign(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ DeleteAdCampaign200Response
Delete a campaign Deletes the whole campaign on the platform, cascading to its ad sets and ads.
-
#delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ Array<(DeleteAdCampaign200Response, Integer, Hash)>
Delete a campaign Deletes the whole campaign on the platform, cascading to its ad sets and ads.
-
#delete_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(DeleteAccountGroup200Response, Integer, Hash)>
Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database.
-
#duplicate_ad(ad_id, opts = {}) ⇒ DuplicateAd200Response
Duplicate an ad Duplicates a single ad via Meta's native
POST /{ad-id}/copies. -
#duplicate_ad_campaign(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ DuplicateAdCampaign200Response
Duplicate a campaign Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (
deepCopy: true). -
#duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ Array<(DuplicateAdCampaign200Response, Integer, Hash)>
Duplicate a campaign Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (`deepCopy: true`).
-
#duplicate_ad_set(ad_set_id, duplicate_ad_set_request, opts = {}) ⇒ DuplicateAdSet200Response
Duplicate an ad set Duplicates an ad set, including its ads and creatives by default (
deepCopy: true), via Meta's nativePOST /{adset-id}/copies. -
#duplicate_ad_set_with_http_info(ad_set_id, duplicate_ad_set_request, opts = {}) ⇒ Array<(DuplicateAdSet200Response, Integer, Hash)>
Duplicate an ad set Duplicates an ad set, including its ads and creatives by default (`deepCopy: true`), via Meta's native `POST /adset-id/copies`.
-
#duplicate_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(DuplicateAd200Response, Integer, Hash)>
Duplicate an ad Duplicates a single ad via Meta's native `POST /ad-id/copies`.
-
#get_ad(ad_id, opts = {}) ⇒ GetAd200Response
Get ad details Returns an ad with its creative, targeting, status, and performance metrics.
-
#get_ad_set_details(ad_set_id, account_id, opts = {}) ⇒ GetAdSetDetails200Response
Live ad-set details incl.
-
#get_ad_set_details_with_http_info(ad_set_id, account_id, opts = {}) ⇒ Array<(GetAdSetDetails200Response, Integer, Hash)>
Live ad-set details incl.
-
#get_ad_tree(opts = {}) ⇒ AdTreeResponse
Get campaign tree Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level.
-
#get_ad_tree_with_http_info(opts = {}) ⇒ Array<(AdTreeResponse, Integer, Hash)>
Get campaign tree Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level.
-
#get_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAd200Response, Integer, Hash)>
Get ad details Returns an ad with its creative, targeting, status, and performance metrics.
-
#get_ads_timeline(account_id, opts = {}) ⇒ AdsTimelineResponse
Get daily account metrics Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range.
-
#get_ads_timeline_with_http_info(account_id, opts = {}) ⇒ Array<(AdsTimelineResponse, Integer, Hash)>
Get daily account metrics Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range.
-
#initialize(api_client = ApiClient.default) ⇒ AdCampaignsApi
constructor
A new instance of AdCampaignsApi.
-
#list_ad_campaigns(opts = {}) ⇒ ListAdCampaigns200Response
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID.
-
#list_ad_campaigns_with_http_info(opts = {}) ⇒ Array<(ListAdCampaigns200Response, Integer, Hash)>
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID.
-
#list_ad_keywords(opts = {}) ⇒ ListAdKeywords200Response
List Search keywords Returns the Google Search keyword criteria (positive and negative) synced from connected Google Ads accounts, one row per ad-group keyword.
-
#list_ad_keywords_with_http_info(opts = {}) ⇒ Array<(ListAdKeywords200Response, Integer, Hash)>
List Search keywords Returns the Google Search keyword criteria (positive and negative) synced from connected Google Ads accounts, one row per ad-group keyword.
-
#list_ads(opts = {}) ⇒ AdsListResponse
List ads Returns a paginated list of ads with metrics computed over an optional date range.
-
#list_ads_with_http_info(opts = {}) ⇒ Array<(AdsListResponse, Integer, Hash)>
List ads Returns a paginated list of ads with metrics computed over an optional date range.
-
#update_ad(ad_id, update_ad_request, opts = {}) ⇒ UpdateAd200Response
Update ad Patch one or more fields on an ad.
-
#update_ad_campaign(campaign_id, update_ad_campaign_request, opts = {}) ⇒ UpdateAdCampaign200Response
Update a campaign Campaign-level edits.
-
#update_ad_campaign_status(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdCampaignStatus200Response
Pause or resume a campaign Writes the campaign's own on/off switch, then lets the platform cascade delivery to its ad sets and ads.
-
#update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume a campaign Writes the campaign's own on/off switch, then lets the platform cascade delivery to its ad sets and ads.
-
#update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts = {}) ⇒ Array<(UpdateAdCampaign200Response, Integer, Hash)>
Update a campaign Campaign-level edits.
-
#update_ad_set(ad_set_id, update_ad_set_request, opts = {}) ⇒ UpdateAdSet200Response
Update an ad set Ad-set-level writes.
-
#update_ad_set_status(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdSetStatus200Response
Pause or resume a single ad set Ad-set-scoped pause/resume (doesn't touch sibling ad sets).
-
#update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdSetStatus200Response, Integer, Hash)>
Pause or resume a single ad set Ad-set-scoped pause/resume (doesn't touch sibling ad sets).
-
#update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts = {}) ⇒ Array<(UpdateAdSet200Response, Integer, Hash)>
Update an ad set Ad-set-level writes.
-
#update_ad_status(ad_id, update_ad_status_request, opts = {}) ⇒ UpdateAdStatus200Response
Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running).
-
#update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {}) ⇒ Array<(UpdateAdStatus200Response, Integer, Hash)>
Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running).
-
#update_ad_with_http_info(ad_id, update_ad_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>
Update ad Patch one or more fields on an ad.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AdCampaignsApi
Returns a new instance of AdCampaignsApi.
19 20 21 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#attach_campaign_assets(campaign_id, attach_campaign_assets_request, opts = {}) ⇒ AttachCampaignAssets201Response
Attach extension assets to a Google Search campaign
Attach sitelinks, callouts and/or structured snippets to an already-existing Google Search campaign — the same builders POST /v1/ads/create uses, but without rebuilding the hierarchy. At least one of sitelinks, callouts or structuredSnippets is required. Google-only. Other platforms have no equivalent extension surface and return 501. Approval status is Google-async; poll asset.policy_summary after review. Assets stay in the account library even if the campaign is later deleted.
28 29 30 31 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 28 def attach_campaign_assets(campaign_id, attach_campaign_assets_request, opts = {}) data, _status_code, _headers = attach_campaign_assets_with_http_info(campaign_id, attach_campaign_assets_request, opts) data end |
#attach_campaign_assets_with_http_info(campaign_id, attach_campaign_assets_request, opts = {}) ⇒ Array<(AttachCampaignAssets201Response, Integer, Hash)>
Attach extension assets to a Google Search campaign Attach sitelinks, callouts and/or structured snippets to an already-existing Google Search campaign — the same builders POST /v1/ads/create uses, but without rebuilding the hierarchy. At least one of sitelinks, callouts or structuredSnippets is required. Google-only. Other platforms have no equivalent extension surface and return 501. Approval status is Google-async; poll `asset.policy_summary` after review. Assets stay in the account library even if the campaign is later deleted.
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 89 90 91 92 93 94 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 39 def attach_campaign_assets_with_http_info(campaign_id, attach_campaign_assets_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.attach_campaign_assets ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.attach_campaign_assets" end # verify the required parameter 'attach_campaign_assets_request' is set if @api_client.config.client_side_validation && attach_campaign_assets_request.nil? fail ArgumentError, "Missing the required parameter 'attach_campaign_assets_request' when calling AdCampaignsApi.attach_campaign_assets" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/assets'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(attach_campaign_assets_request) # return_type return_type = opts[:debug_return_type] || 'AttachCampaignAssets201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.attach_campaign_assets", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#attach_campaign_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#boost_post(boost_post_request, opts = {}) ⇒ UpdateAd200Response
Boost post as ad
Creates a paid ad from an existing published post, keeping the post's engagement. By default it provisions the whole hierarchy (campaign, ad set, ad). Attach shape (Meta). Send adSetId to put the ad under an EXISTING ad set instead, so that ad set keeps its learning phase. It then owns budget, schedule and targeting, and sending any of those alongside adSetId is a 400 rather than a silent drop. budget is required only without adSetId. instagramAccountId, destinationType and adSetId are Meta-only and return 400 on other platforms. Retries. Boosts are NOT idempotent and can take minutes when Meta requires re-hosting an Instagram video, so do not retry on client timeout. Send an Idempotency-Key header to make retries safe: same key and body replays the original 201, and distinct keys always create distinct ads. Without the header, an identical request is treated as a retry: while one is in flight it returns 409, and within 10 minutes of a completed boost it returns the already-created ad instead of creating another. To intentionally duplicate an ad, send distinct Idempotency-Keys (or vary the body, e.g. the name).
102 103 104 105 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 102 def boost_post(boost_post_request, opts = {}) data, _status_code, _headers = boost_post_with_http_info(boost_post_request, opts) data end |
#boost_post_with_http_info(boost_post_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>
Boost post as ad Creates a paid ad from an existing published post, keeping the post's engagement. By default it provisions the whole hierarchy (campaign, ad set, ad). Attach shape (Meta). Send `adSetId` to put the ad under an EXISTING ad set instead, so that ad set keeps its learning phase. It then owns `budget`, `schedule` and `targeting`, and sending any of those alongside `adSetId` is a 400 rather than a silent drop. `budget` is required only without `adSetId`. `instagramAccountId`, `destinationType` and `adSetId` are Meta-only and return 400 on other platforms. Retries. Boosts are NOT idempotent and can take minutes when Meta requires re-hosting an Instagram video, so do not retry on client timeout. Send an Idempotency-Key header to make retries safe: same key and body replays the original 201, and distinct keys always create distinct ads. Without the header, an identical request is treated as a retry: while one is in flight it returns 409, and within 10 minutes of a completed boost it returns the already-created ad instead of creating another. To intentionally duplicate an ad, send distinct Idempotency-Keys (or vary the body, e.g. the name).
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 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 113 def boost_post_with_http_info(boost_post_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.boost_post ...' end # verify the required parameter 'boost_post_request' is set if @api_client.config.client_side_validation && boost_post_request.nil? fail ArgumentError, "Missing the required parameter 'boost_post_request' when calling AdCampaignsApi.boost_post" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AdCampaignsApi.boost_post, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/v1/ads/boost' # 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 header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(boost_post_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAd200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.boost_post", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#boost_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#bulk_update_ad_campaign_status(bulk_update_ad_campaign_status_request, opts = {}) ⇒ BulkUpdateAdCampaignStatus200Response
Pause or resume many campaigns Process up to 50 campaigns in one call. Each campaign is updated concurrently and the response contains a per-campaign result so a single bad row does not fail the whole batch.
176 177 178 179 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 176 def bulk_update_ad_campaign_status(bulk_update_ad_campaign_status_request, opts = {}) data, _status_code, _headers = bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts) data end |
#bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts = {}) ⇒ Array<(BulkUpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume many campaigns Process up to 50 campaigns in one call. Each campaign is updated concurrently and the response contains a per-campaign result so a single bad row does not fail the whole batch.
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 236 237 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 186 def bulk_update_ad_campaign_status_with_http_info(bulk_update_ad_campaign_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.bulk_update_ad_campaign_status ...' end # verify the required parameter 'bulk_update_ad_campaign_status_request' is set if @api_client.config.client_side_validation && bulk_update_ad_campaign_status_request.nil? fail ArgumentError, "Missing the required parameter 'bulk_update_ad_campaign_status_request' when calling AdCampaignsApi.bulk_update_ad_campaign_status" end # resource path local_var_path = '/v1/ads/campaigns/bulk-status' # 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(bulk_update_ad_campaign_status_request) # return_type return_type = opts[:debug_return_type] || 'BulkUpdateAdCampaignStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.bulk_update_ad_campaign_status", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#bulk_update_ad_campaign_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_ad_campaign(create_ad_campaign_request, opts = {}) ⇒ CreateAdCampaign201Response
Create a standalone campaign
Creates a campaign WITHOUT its first ad set / ad (the ODAX shell only). Ad sets join it later via existingCampaignId on the create endpoints. A budget here is campaign-level (CBO) by definition; omit it for ABO (each ad set carries its own budget). Created PAUSED unless status: ACTIVE. The campaign materializes in /v1/ads/tree via the next sync discovery pass. Idempotency: send an Idempotency-Key header to make retries safe.
245 246 247 248 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 245 def create_ad_campaign(create_ad_campaign_request, opts = {}) data, _status_code, _headers = create_ad_campaign_with_http_info(create_ad_campaign_request, opts) data end |
#create_ad_campaign_with_http_info(create_ad_campaign_request, opts = {}) ⇒ Array<(CreateAdCampaign201Response, Integer, Hash)>
Create a standalone campaign Creates a campaign WITHOUT its first ad set / ad (the ODAX shell only). Ad sets join it later via `existingCampaignId` on the create endpoints. A budget here is campaign-level (CBO) by definition; omit it for ABO (each ad set carries its own budget). Created `PAUSED` unless `status: ACTIVE`. The campaign materializes in `/v1/ads/tree` via the next sync discovery pass. Idempotency: send an `Idempotency-Key` header to make retries safe.
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 304 305 306 307 308 309 310 311 312 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 256 def create_ad_campaign_with_http_info(create_ad_campaign_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.create_ad_campaign ...' end # verify the required parameter 'create_ad_campaign_request' is set if @api_client.config.client_side_validation && create_ad_campaign_request.nil? fail ArgumentError, "Missing the required parameter 'create_ad_campaign_request' when calling AdCampaignsApi.create_ad_campaign" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AdCampaignsApi.create_ad_campaign, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/v1/ads/campaigns' # 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 header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_ad_campaign_request) # return_type return_type = opts[:debug_return_type] || 'CreateAdCampaign201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.create_ad_campaign", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#create_ad_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_standalone_ad(create_standalone_ad_request, opts = {}) ⇒ CreateStandaloneAd200Response
Create standalone ad
Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, LinkedIn, and OpenAI Ads (ChatGPT Ads). Supports three mutually-exclusive request shapes selected by the body, a legacy single-creative shape (all platforms, default), a Meta-only multi-creative shape via the creatives array (one ad set with N ads sharing budget and targeting), and an attach shape via adSetId that adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, TikTok, and LinkedIn; on LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted). Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content "dark post" authored by a Company Page (see organizationId); supported goals are engagement, traffic, awareness, and video_views (video ads use the video field; video_views requires a video), and traffic ads require linkUrl. Idempotency: this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an Idempotency-Key header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with Idempotent-Replayed: true) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.
320 321 322 323 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 320 def create_standalone_ad(create_standalone_ad_request, opts = {}) data, _status_code, _headers = create_standalone_ad_with_http_info(create_standalone_ad_request, opts) data end |
#create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) ⇒ Array<(CreateStandaloneAd200Response, Integer, Hash)>
Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, LinkedIn, and OpenAI Ads (ChatGPT Ads). Supports three mutually-exclusive request shapes selected by the body, a legacy single-creative shape (all platforms, default), a Meta-only multi-creative shape via the creatives array (one ad set with N ads sharing budget and targeting), and an attach shape via adSetId that adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, TikTok, and LinkedIn; on LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted). Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content "dark post" authored by a Company Page (see `organizationId`); supported goals are engagement, traffic, awareness, and video_views (video ads use the `video` field; video_views requires a video), and traffic ads require `linkUrl`. Idempotency: this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an `Idempotency-Key` header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with `Idempotent-Replayed: true`) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.
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 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 331 def create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.create_standalone_ad ...' end # verify the required parameter 'create_standalone_ad_request' is set if @api_client.config.client_side_validation && create_standalone_ad_request.nil? fail ArgumentError, "Missing the required parameter 'create_standalone_ad_request' when calling AdCampaignsApi.create_standalone_ad" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AdCampaignsApi.create_standalone_ad, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/v1/ads/create' # 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 header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_standalone_ad_request) # return_type return_type = opts[:debug_return_type] || 'CreateStandaloneAd200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.create_standalone_ad", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#create_standalone_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_ad(ad_id, opts = {}) ⇒ DeleteAccountGroup200Response
Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history. OpenAI Ads has no delete API; the ad is archived instead (a terminal state, the closest equivalent).
394 395 396 397 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 394 def delete_ad(ad_id, opts = {}) data, _status_code, _headers = delete_ad_with_http_info(ad_id, opts) data end |
#delete_ad_campaign(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ DeleteAdCampaign200Response
Delete a campaign
Deletes the whole campaign on the platform, cascading to its ad sets and ads. Locally, all Ad documents for this campaign are marked status: cancelled. Empty campaigns. A campaign with zero ads has no local Ad documents to resolve, so it is invisible to /v1/ads/tree and this endpoint would 404. That state is produced by the two-step create flow (campaign, then ads via existingCampaignId) whenever Meta rejects the ad step. To delete such a shell, send accountId in the body: we skip the local lookup entirely and forward the delete to Meta. accountId is ignored when the campaign does have ads.
458 459 460 461 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 458 def delete_ad_campaign(campaign_id, delete_ad_campaign_request, opts = {}) data, _status_code, _headers = delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts) data end |
#delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts = {}) ⇒ Array<(DeleteAdCampaign200Response, Integer, Hash)>
Delete a campaign Deletes the whole campaign on the platform, cascading to its ad sets and ads. Locally, all Ad documents for this campaign are marked `status: cancelled`. Empty campaigns. A campaign with zero ads has no local Ad documents to resolve, so it is invisible to `/v1/ads/tree` and this endpoint would 404. That state is produced by the two-step create flow (campaign, then ads via `existingCampaignId`) whenever Meta rejects the ad step. To delete such a shell, send `accountId` in the body: we skip the local lookup entirely and forward the delete to Meta. `accountId` is ignored when the campaign does have ads.
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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 469 def delete_ad_campaign_with_http_info(campaign_id, delete_ad_campaign_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.delete_ad_campaign ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.delete_ad_campaign" end # verify the required parameter 'delete_ad_campaign_request' is set if @api_client.config.client_side_validation && delete_ad_campaign_request.nil? fail ArgumentError, "Missing the required parameter 'delete_ad_campaign_request' when calling AdCampaignsApi.delete_ad_campaign" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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(delete_ad_campaign_request) # return_type return_type = opts[:debug_return_type] || 'DeleteAdCampaign200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.delete_ad_campaign", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#delete_ad_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(DeleteAccountGroup200Response, Integer, Hash)>
Cancel an ad Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history. OpenAI Ads has no delete API; the ad is archived instead (a terminal state, the closest equivalent).
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 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 404 def delete_ad_with_http_info(ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.delete_ad ...' 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 AdCampaignsApi.delete_ad" end # resource path local_var_path = '/v1/ads/{adId}'.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] || 'DeleteAccountGroup200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.delete_ad", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#delete_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#duplicate_ad(ad_id, opts = {}) ⇒ DuplicateAd200Response
Duplicate an ad
Duplicates a single ad via Meta's native POST /{ad-id}/copies. The copy is created paused. adSetId retargets the copy into another ad set; omitted = the source's own ad set. Accepts the Zernio ad id or the platform ad id. Sync discovery is triggered automatically (syncAfter: false to skip).
533 534 535 536 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 533 def duplicate_ad(ad_id, opts = {}) data, _status_code, _headers = duplicate_ad_with_http_info(ad_id, opts) data end |
#duplicate_ad_campaign(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ DuplicateAdCampaign200Response
Duplicate a campaign
Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (deepCopy: true). The copy is created paused so callers can review before launching. Per-platform implementation: - Meta uses the native POST /{campaign-id}/copies endpoint. - TikTok has no native copy primitive; Zernio walks the source graph (/v2/campaign/get/, /v2/adgroup/get/, /v2/ad/get/) and recreates each entity via the corresponding /create/ endpoints, carrying over budget / targeting / bid_type / bid_price / deep_bid_type / creative fields. Spark Ad linkage (tiktok_item_id) is preserved. - LinkedIn has no native copy primitive; Zernio walks the source CampaignGroup → Campaigns → Creatives and recreates each entity, carrying over type / costType / unitCost / optimizationTargetType / creativeSelection / objectiveType / format / dailyBudget / totalBudget / targetingCriteria / runSchedule and every Creative's content object verbatim. statusOption: INHERITED_FROM_SOURCE is evaluated per entity: any Group / Campaign / Creative whose source is ACTIVE gets its clone activated too. Duplicating an ACTIVE campaign with INHERITED_FROM_SOURCE starts a second front of spend the moment the clone activates — the safe default is PAUSED. The new hierarchy is asynchronous to materialize in our DB — we trigger sync discovery automatically. Set syncAfter: false to skip and poll /v1/ads/tree on your own cadence. Other platforms return 501 Not Implemented.
610 611 612 613 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 610 def duplicate_ad_campaign(campaign_id, duplicate_ad_campaign_request, opts = {}) data, _status_code, _headers = duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts) data end |
#duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts = {}) ⇒ Array<(DuplicateAdCampaign200Response, Integer, Hash)>
Duplicate a campaign Duplicates a campaign, including its ad sets, ads, creatives, and targeting by default (`deepCopy: true`). The copy is created paused so callers can review before launching. Per-platform implementation: - Meta uses the native `POST /campaign-id/copies` endpoint. - TikTok has no native copy primitive; Zernio walks the source graph (`/v2/campaign/get/`, `/v2/adgroup/get/`, `/v2/ad/get/`) and recreates each entity via the corresponding `/create/` endpoints, carrying over budget / targeting / bid_type / bid_price / deep_bid_type / creative fields. Spark Ad linkage (`tiktok_item_id`) is preserved. - LinkedIn has no native copy primitive; Zernio walks the source CampaignGroup → Campaigns → Creatives and recreates each entity, carrying over `type` / `costType` / `unitCost` / `optimizationTargetType` / `creativeSelection` / `objectiveType` / `format` / `dailyBudget` / `totalBudget` / `targetingCriteria` / `runSchedule` and every Creative's `content` object verbatim. `statusOption: INHERITED_FROM_SOURCE` is evaluated per entity: any Group / Campaign / Creative whose source is `ACTIVE` gets its clone activated too. Duplicating an ACTIVE campaign with `INHERITED_FROM_SOURCE` starts a second front of spend the moment the clone activates — the safe default is `PAUSED`. The new hierarchy is asynchronous to materialize in our DB — we trigger sync discovery automatically. Set `syncAfter: false` to skip and poll `/v1/ads/tree` on your own cadence. Other platforms return 501 Not Implemented.
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 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 622 def duplicate_ad_campaign_with_http_info(campaign_id, duplicate_ad_campaign_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.duplicate_ad_campaign ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.duplicate_ad_campaign" end # verify the required parameter 'duplicate_ad_campaign_request' is set if @api_client.config.client_side_validation && duplicate_ad_campaign_request.nil? fail ArgumentError, "Missing the required parameter 'duplicate_ad_campaign_request' when calling AdCampaignsApi.duplicate_ad_campaign" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AdCampaignsApi.duplicate_ad_campaign, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/duplicate'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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 header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(duplicate_ad_campaign_request) # return_type return_type = opts[:debug_return_type] || 'DuplicateAdCampaign200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.duplicate_ad_campaign", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#duplicate_ad_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#duplicate_ad_set(ad_set_id, duplicate_ad_set_request, opts = {}) ⇒ DuplicateAdSet200Response
Duplicate an ad set
Duplicates an ad set, including its ads and creatives by default (deepCopy: true), via Meta's native POST /{adset-id}/copies. The copy is created paused so callers can review before launching. campaignId retargets the copy into another campaign; omitted = the source's own campaign. The new hierarchy materializes asynchronously — sync discovery is triggered automatically (syncAfter: false to skip).
691 692 693 694 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 691 def duplicate_ad_set(ad_set_id, duplicate_ad_set_request, opts = {}) data, _status_code, _headers = duplicate_ad_set_with_http_info(ad_set_id, duplicate_ad_set_request, opts) data end |
#duplicate_ad_set_with_http_info(ad_set_id, duplicate_ad_set_request, opts = {}) ⇒ Array<(DuplicateAdSet200Response, Integer, Hash)>
Duplicate an ad set Duplicates an ad set, including its ads and creatives by default (`deepCopy: true`), via Meta's native `POST /adset-id/copies`. The copy is created paused so callers can review before launching. `campaignId` retargets the copy into another campaign; omitted = the source's own campaign. The new hierarchy materializes asynchronously — sync discovery is triggered automatically (`syncAfter: false` to skip).
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 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 703 def duplicate_ad_set_with_http_info(ad_set_id, duplicate_ad_set_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.duplicate_ad_set ...' end # verify the required parameter 'ad_set_id' is set if @api_client.config.client_side_validation && ad_set_id.nil? fail ArgumentError, "Missing the required parameter 'ad_set_id' when calling AdCampaignsApi.duplicate_ad_set" end # verify the required parameter 'duplicate_ad_set_request' is set if @api_client.config.client_side_validation && duplicate_ad_set_request.nil? fail ArgumentError, "Missing the required parameter 'duplicate_ad_set_request' when calling AdCampaignsApi.duplicate_ad_set" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AdCampaignsApi.duplicate_ad_set, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}/duplicate'.sub('{' + 'adSetId' + '}', CGI.escape(ad_set_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 header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(duplicate_ad_set_request) # return_type return_type = opts[:debug_return_type] || 'DuplicateAdSet200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.duplicate_ad_set", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#duplicate_ad_set\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#duplicate_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(DuplicateAd200Response, Integer, Hash)>
Duplicate an ad Duplicates a single ad via Meta's native `POST /ad-id/copies`. The copy is created paused. `adSetId` retargets the copy into another ad set; omitted = the source's own ad set. Accepts the Zernio ad id or the platform ad id. Sync discovery is triggered automatically (`syncAfter: false` to skip).
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 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 545 def duplicate_ad_with_http_info(ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.duplicate_ad ...' 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 AdCampaignsApi.duplicate_ad" end if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling AdCampaignsApi.duplicate_ad, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/v1/ads/{adId}/duplicate'.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'] # 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 header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'duplicate_ad_request']) # return_type return_type = opts[:debug_return_type] || 'DuplicateAd200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.duplicate_ad", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#duplicate_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad(ad_id, opts = {}) ⇒ GetAd200Response
Get ad details
Returns an ad with its creative, targeting, status, and performance metrics. The {adId} path segment accepts any identifier dialect Zernio indexes for the ad: - the Zernio internal _id (24-char hex) - Meta's numeric platformAdId (the value shipped in comment.received webhooks as comment.ad.id) - the creative's effective_object_story_id ({pageId}_{postId} shape, Facebook side) - the creative's effective_instagram_media_id (Instagram side) Any of the four resolve to the same ad. Caller doesn't need a translation step.
770 771 772 773 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 770 def get_ad(ad_id, opts = {}) data, _status_code, _headers = get_ad_with_http_info(ad_id, opts) data end |
#get_ad_set_details(ad_set_id, account_id, opts = {}) ⇒ GetAdSetDetails200Response
Live ad-set details incl. learning phase
Reads the ad set live from Meta, returned verbatim. The default projection includes learning_stage_info (learning-phase status: LEARNING / SUCCESS / FAIL / WAIVING — Meta omits its status key on paused ad sets), delivery settings, budgets, schedule and targeting. fields is a raw-passthrough override; unknown fields return Meta's 400 verbatim.
835 836 837 838 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 835 def get_ad_set_details(ad_set_id, account_id, opts = {}) data, _status_code, _headers = get_ad_set_details_with_http_info(ad_set_id, account_id, opts) data end |
#get_ad_set_details_with_http_info(ad_set_id, account_id, opts = {}) ⇒ Array<(GetAdSetDetails200Response, Integer, Hash)>
Live ad-set details incl. learning phase Reads the ad set live from Meta, returned verbatim. The default projection includes `learning_stage_info` (learning-phase status: LEARNING / SUCCESS / FAIL / WAIVING — Meta omits its `status` key on paused ad sets), delivery settings, budgets, schedule and targeting. `fields` is a raw-passthrough override; unknown fields return Meta's 400 verbatim.
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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 847 def get_ad_set_details_with_http_info(ad_set_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_ad_set_details ...' end # verify the required parameter 'ad_set_id' is set if @api_client.config.client_side_validation && ad_set_id.nil? fail ArgumentError, "Missing the required parameter 'ad_set_id' when calling AdCampaignsApi.get_ad_set_details" end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCampaignsApi.get_ad_set_details" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}'.sub('{' + 'adSetId' + '}', CGI.escape(ad_set_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id 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] || 'GetAdSetDetails200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_ad_set_details", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#get_ad_set_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad_tree(opts = {}) ⇒ AdTreeResponse
Get campaign tree
Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic "Ungrouped" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass timeIncrement=1 to also get a daily breakdown: each node gains a daily[] array of per-day metrics (same fields as the aggregated metrics) in the same call. Use dailyLevel (campaign default, or adset / ad) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends. Deleted objects stay in the tree. Deleting an ad or a campaign is a soft delete: the Ad documents move to status: cancelled and are kept indefinitely, so their historical spend still counts toward the metrics of any date range they fall in. There is no pruning job and no retention window. Filter on status if your view should hide them, but do that after reading the totals, not before.
922 923 924 925 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 922 def get_ad_tree(opts = {}) data, _status_code, _headers = get_ad_tree_with_http_info(opts) data end |
#get_ad_tree_with_http_info(opts = {}) ⇒ Array<(AdTreeResponse, Integer, Hash)>
Get campaign tree Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level. Uses a two-stage aggregation: ads are grouped into ad sets, then ad sets into campaigns. Metrics are computed over an optional date range, then rolled up from ad level to ad set and campaign levels. Pagination is at the campaign level. Ads without a campaign or ad set ID are grouped into synthetic "Ungrouped" buckets. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. Pass `timeIncrement=1` to also get a daily breakdown: each node gains a `daily` array of per-day metrics (same fields as the aggregated `metrics`) in the same call. Use `dailyLevel` (`campaign` default, or `adset` / `ad`) to choose which levels carry the series. This replaces calling the tree once per day for per-campaign daily trends. Deleted objects stay in the tree. Deleting an ad or a campaign is a soft delete: the Ad documents move to `status: cancelled` and are kept indefinitely, so their historical spend still counts toward the metrics of any date range they fall in. There is no pruning job and no retention window. Filter on `status` if your view should hide them, but do that after reading the totals, not before.
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 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 948 def get_ad_tree_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_ad_tree ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdCampaignsApi.get_ad_tree, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.get_ad_tree, 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 AdCampaignsApi.get_ad_tree, must be greater than or equal to 1.' end allowable_values = ["zernio", "all"] if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source']) fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}" end allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter", "openai"] if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform']) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'min_spend'].nil? && opts[:'min_spend'] < 0 fail ArgumentError, 'invalid value for "opts[:"min_spend"]" when calling AdCampaignsApi.get_ad_tree, must be greater than or equal to 0.' end allowable_values = ["newest", "oldest", "spend_desc", "spend_asc"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end allowable_values = [1] if @api_client.config.client_side_validation && opts[:'time_increment'] && !allowable_values.include?(opts[:'time_increment']) fail ArgumentError, "invalid value for \"time_increment\", must be one of #{allowable_values}" end allowable_values = ["campaign", "adset", "ad"] if @api_client.config.client_side_validation && opts[:'daily_level'] && !allowable_values.include?(opts[:'daily_level']) fail ArgumentError, "invalid value for \"daily_level\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/ads/tree' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil? query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil? query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? query_params[:'hasDelivery'] = opts[:'has_delivery'] if !opts[:'has_delivery'].nil? query_params[:'minSpend'] = opts[:'min_spend'] if !opts[:'min_spend'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'timeIncrement'] = opts[:'time_increment'] if !opts[:'time_increment'].nil? query_params[:'dailyLevel'] = opts[:'daily_level'] if !opts[:'daily_level'].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] || 'AdTreeResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_ad_tree", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#get_ad_tree\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAd200Response, Integer, Hash)>
Get ad details Returns an ad with its creative, targeting, status, and performance metrics. The `adId` path segment accepts any identifier dialect Zernio indexes for the ad: - the Zernio internal `_id` (24-char hex) - Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`) - the creative's `effective_object_story_id` (`pageId_postId` shape, Facebook side) - the creative's `effective_instagram_media_id` (Instagram side) Any of the four resolve to the same ad. Caller doesn't need a translation step.
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 823 824 825 826 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 780 def get_ad_with_http_info(ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_ad ...' 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 AdCampaignsApi.get_ad" end # resource path local_var_path = '/v1/ads/{adId}'.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] || 'GetAd200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_ad", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#get_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ads_timeline(account_id, opts = {}) ⇒ AdsTimelineResponse
Get daily account metrics
Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range. Use this for dashboards that draw a daily-spend or daily-conversions chart, instead of calling /v1/ads/tree once per day. accountId is required. The lookup is sibling-expanded so passing the metaads ID also includes ads under the linked facebook / instagram posting account (and vice-versa) — same convention as /v1/ads/tree and /v1/ads. Date range defaults to the last 90 days. Capped at 730 days. Ranges older than the ingested history return a 202 immediately with the covered part and backfillPending: true while the rest is backfilled in the background; repeat the request shortly until it returns 200 with full data.
1054 1055 1056 1057 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1054 def get_ads_timeline(account_id, opts = {}) data, _status_code, _headers = get_ads_timeline_with_http_info(account_id, opts) data end |
#get_ads_timeline_with_http_info(account_id, opts = {}) ⇒ Array<(AdsTimelineResponse, Integer, Hash)>
Get daily account metrics Returns daily aggregate metrics across all ads in a SocialAccount as a single time series — one row per calendar day in the requested range. Use this for dashboards that draw a daily-spend or daily-conversions chart, instead of calling `/v1/ads/tree` once per day. `accountId` is required. The lookup is sibling-expanded so passing the `metaads` ID also includes ads under the linked `facebook` / `instagram` posting account (and vice-versa) — same convention as `/v1/ads/tree` and `/v1/ads`. Date range defaults to the last 90 days. Capped at 730 days. Ranges older than the ingested history return a `202` immediately with the covered part and `backfillPending: true` while the rest is backfilled in the background; repeat the request shortly until it returns 200 with full data.
1068 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 1121 1122 1123 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1068 def get_ads_timeline_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_ads_timeline ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling AdCampaignsApi.get_ads_timeline" end allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter", "openai"] if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform']) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/ads/timeline' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].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] || 'AdsTimelineResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_ads_timeline", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#get_ads_timeline\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ad_campaigns(opts = {}) ⇒ ListAdCampaigns200Response
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign. Campaign status is derived from child ad statuses (active > pending_review > paused > error > completed > cancelled > rejected).
1143 1144 1145 1146 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1143 def list_ad_campaigns(opts = {}) data, _status_code, _headers = list_ad_campaigns_with_http_info(opts) data end |
#list_ad_campaigns_with_http_info(opts = {}) ⇒ Array<(ListAdCampaigns200Response, Integer, Hash)>
List campaigns Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign. Campaign status is derived from child ad statuses (active > pending_review > paused > error > completed > cancelled > rejected).
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1166 def list_ad_campaigns_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_ad_campaigns ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdCampaignsApi.list_ad_campaigns, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ad_campaigns, 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 AdCampaignsApi.list_ad_campaigns, must be greater than or equal to 1.' end allowable_values = ["zernio", "all"] if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source']) fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}" end allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter", "openai"] if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform']) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'min_spend'].nil? && opts[:'min_spend'] < 0 fail ArgumentError, 'invalid value for "opts[:"min_spend"]" when calling AdCampaignsApi.list_ad_campaigns, must be greater than or equal to 0.' end # resource path local_var_path = '/v1/ads/campaigns' # query parameters query_params = opts[:query_params] || {} query_params[:'includeEmpty'] = opts[:'include_empty'] if !opts[:'include_empty'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil? query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? query_params[:'hasDelivery'] = opts[:'has_delivery'] if !opts[:'has_delivery'].nil? query_params[:'minSpend'] = opts[:'min_spend'] if !opts[:'min_spend'].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] || 'ListAdCampaigns200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_ad_campaigns", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#list_ad_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ad_keywords(opts = {}) ⇒ ListAdKeywords200Response
List Search keywords Returns the Google Search keyword criteria (positive and negative) synced from connected Google Ads accounts, one row per ad-group keyword. Refreshed about once a week per Google Ads customer (the keyword sweep rides the ads discovery pass on a slower slot, to stay inside Google's shared daily API quota), so keywords added on Google can take several days to appear. A customer synced for the first time is populated on the next discovery pass rather than waiting for its weekly slot, and connecting an account or triggering a manual sync refreshes it immediately. Campaign-level negative keywords are not included; only ad-group-level criteria are.
1263 1264 1265 1266 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1263 def list_ad_keywords(opts = {}) data, _status_code, _headers = list_ad_keywords_with_http_info(opts) data end |
#list_ad_keywords_with_http_info(opts = {}) ⇒ Array<(ListAdKeywords200Response, Integer, Hash)>
List Search keywords Returns the Google Search keyword criteria (positive and negative) synced from connected Google Ads accounts, one row per ad-group keyword. Refreshed about once a week per Google Ads customer (the keyword sweep rides the ads discovery pass on a slower slot, to stay inside Google's shared daily API quota), so keywords added on Google can take several days to appear. A customer synced for the first time is populated on the next discovery pass rather than waiting for its weekly slot, and connecting an account or triggering a manual sync refreshes it immediately. Campaign-level negative keywords are not included; only ad-group-level criteria are.
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1283 def list_ad_keywords_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_ad_keywords ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdCampaignsApi.list_ad_keywords, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ad_keywords, must be smaller than or equal to 500.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ad_keywords, must be greater than or equal to 1.' end allowable_values = ["active", "paused"] if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status']) fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}" end allowable_values = ["exact", "phrase", "broad", "unknown"] if @api_client.config.client_side_validation && opts[:'match_type'] && !allowable_values.include?(opts[:'match_type']) fail ArgumentError, "invalid value for \"match_type\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length > 200 fail ArgumentError, 'invalid value for "opts[:"search"]" when calling AdCampaignsApi.list_ad_keywords, the character length must be smaller than or equal to 200.' end # resource path local_var_path = '/v1/ads/keywords' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil? query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? query_params[:'adSetId'] = opts[:'ad_set_id'] if !opts[:'ad_set_id'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'matchType'] = opts[:'match_type'] if !opts[:'match_type'].nil? query_params[:'negative'] = opts[:'negative'] if !opts[:'negative'].nil? query_params[:'search'] = opts[:'search'] if !opts[:'search'].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] || 'ListAdKeywords200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_ad_keywords", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#list_ad_keywords\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ads(opts = {}) ⇒ AdsListResponse
List ads
Returns a paginated list of ads with metrics computed over an optional date range. Use source=all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) — those are the post/media the ad's engagement lives on, and are also returned on each ad's creative object. Then call GET /v1/ads/adId/comments with the returned ad id.
1381 1382 1383 1384 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1381 def list_ads(opts = {}) data, _status_code, _headers = list_ads_with_http_info(opts) data end |
#list_ads_with_http_info(opts = {}) ⇒ Array<(AdsListResponse, Integer, Hash)>
List ads Returns a paginated list of ads with metrics computed over an optional date range. Use source=all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) — those are the post/media the ad's engagement lives on, and are also returned on each ad's `creative` object. Then call GET /v1/ads/adId/comments with the returned ad id.
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1405 def list_ads_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_ads ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdCampaignsApi.list_ads, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ads, must be smaller than or equal to 500.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ads, must be greater than or equal to 1.' end allowable_values = ["zernio", "all"] if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source']) fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}" end allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter", "openai"] if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform']) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/ads' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil? query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil? query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil? query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? query_params[:'platformAdId'] = opts[:'platform_ad_id'] if !opts[:'platform_ad_id'].nil? query_params[:'effectiveObjectStoryId'] = opts[:'effective_object_story_id'] if !opts[:'effective_object_story_id'].nil? query_params[:'effectiveInstagramMediaId'] = opts[:'effective_instagram_media_id'] if !opts[:'effective_instagram_media_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].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] || 'AdsListResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_ads", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#list_ads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad(ad_id, update_ad_request, opts = {}) ⇒ UpdateAd200Response
Update ad
Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform. Per-platform support: - Meta (Facebook + Instagram): all fields supported. - TikTok: status, budget, targeting (via /v2/adgroup/update/), and creative (via /v2/ad/update/ patch-style — headline is ignored, body becomes ad_text). - Google: status, budget, and KEYWORD edits via targeting.keywords / targeting.negativeKeywords — each list you send becomes the FULL new set of its kind on the ad group (criteria not in the list are removed); a kind left out is untouched. Any other targeting field returns 400: Google cannot mutate broad targeting post-create without recreating the campaign. creative returns 501. - Pinterest / X / LinkedIn / OpenAI Ads: status + budget only. Sending targeting or creative returns 501 with code unsupported_platform_operation. OpenAI Ads budget is lifetime-only (see budget.type below).
1490 1491 1492 1493 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1490 def update_ad(ad_id, update_ad_request, opts = {}) data, _status_code, _headers = update_ad_with_http_info(ad_id, update_ad_request, opts) data end |
#update_ad_campaign(campaign_id, update_ad_campaign_request, opts = {}) ⇒ UpdateAdCampaign200Response
Update a campaign
Campaign-level edits. Send at least one of budget, bidStrategy, name or platformSpecificData. An unsupported field is always an error, never a silent drop. | Body field | Meta | Google | Others | |---|---|---|---| | bidStrategy | Yes | Yes | 501 | | bidAmount, roasAverageFloor | 400 — ad-set level | Yes | 400 | | budget (CBO; ABO returns 409) | Yes | 501 | 501 | | name | Yes | 501 | 501 | | platformSpecificData.spendCap | Yes | 400 | 400 | | accountId (empty campaigns) | Yes | - | - | Google maps the shared enum onto its own strategies: LOWEST_COST_WITHOUT_CAP to Maximize Clicks, LOWEST_COST_WITH_BID_CAP to Maximize Clicks with a max CPC (bidAmount), COST_CAP to Target CPA (bidAmount), LOWEST_COST_WITH_MIN_ROAS to Target ROAS (roasAverageFloor). A campaign on a PORTFOLIO bidding strategy is rejected: detach it in Google Ads first, since it is shared across campaigns. accountId forwards the update straight to Meta for a campaign with zero ads, which would otherwise 404; the response then carries updated: 0.
1564 1565 1566 1567 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1564 def update_ad_campaign(campaign_id, update_ad_campaign_request, opts = {}) data, _status_code, _headers = update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts) data end |
#update_ad_campaign_status(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdCampaignStatus200Response
Pause or resume a campaign
Writes the campaign's own on/off switch, then lets the platform cascade delivery to its ad sets and ads. Makes one platform API call, not one per ad. The switch is always written, whatever delivery status the ads underneath report: an ad still in review does not block resuming its campaign. The echoed status is the confirmation that it landed. updated / skipped describe only the ads whose own stored status CHANGED alongside it, so updated: 0 is a normal successful response, not a no-op. Ads are skipped when they are in a terminal status (rejected, completed, cancelled), already in the target state, or switched on but not yet delivering — the last group keeps its pending_review / error status until the platform reports what it became. skippedReasons names which case applies. On Meta this flips the campaign only. An ad set paused in its own right stays paused, so pair this with PUT /v1/ads/ad-sets/adSetId/status when you also need the ad set switched back on.
1638 1639 1640 1641 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1638 def update_ad_campaign_status(campaign_id, update_ad_campaign_status_request, opts = {}) data, _status_code, _headers = update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts) data end |
#update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume a campaign Writes the campaign's own on/off switch, then lets the platform cascade delivery to its ad sets and ads. Makes one platform API call, not one per ad. The switch is always written, whatever delivery status the ads underneath report: an ad still in review does not block resuming its campaign. The echoed `status` is the confirmation that it landed. `updated` / `skipped` describe only the ads whose own stored status CHANGED alongside it, so `updated: 0` is a normal successful response, not a no-op. Ads are skipped when they are in a terminal status (rejected, completed, cancelled), already in the target state, or switched on but not yet delivering — the last group keeps its `pending_review` / `error` status until the platform reports what it became. `skippedReasons` names which case applies. On Meta this flips the campaign only. An ad set paused in its own right stays paused, so pair this with PUT /v1/ads/ad-sets/adSetId/status when you also need the ad set switched back on.
1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1649 def update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_campaign_status ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.update_ad_campaign_status" end # verify the required parameter 'update_ad_campaign_status_request' is set if @api_client.config.client_side_validation && update_ad_campaign_status_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_campaign_status_request' when calling AdCampaignsApi.update_ad_campaign_status" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/status'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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_campaign_status_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdCampaignStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_campaign_status", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_campaign_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts = {}) ⇒ Array<(UpdateAdCampaign200Response, Integer, Hash)>
Update a campaign Campaign-level edits. Send at least one of `budget`, `bidStrategy`, `name` or `platformSpecificData`. An unsupported field is always an error, never a silent drop. | Body field | Meta | Google | Others | |---|---|---|---| | `bidStrategy` | Yes | Yes | 501 | | `bidAmount`, `roasAverageFloor` | 400 — ad-set level | Yes | 400 | | `budget` (CBO; ABO returns 409) | Yes | 501 | 501 | | `name` | Yes | 501 | 501 | | `platformSpecificData.spendCap` | Yes | 400 | 400 | | `accountId` (empty campaigns) | Yes | - | - | Google maps the shared enum onto its own strategies: `LOWEST_COST_WITHOUT_CAP` to Maximize Clicks, `LOWEST_COST_WITH_BID_CAP` to Maximize Clicks with a max CPC (`bidAmount`), `COST_CAP` to Target CPA (`bidAmount`), `LOWEST_COST_WITH_MIN_ROAS` to Target ROAS (`roasAverageFloor`). A campaign on a PORTFOLIO bidding strategy is rejected: detach it in Google Ads first, since it is shared across campaigns. `accountId` forwards the update straight to Meta for a campaign with zero ads, which would otherwise 404; the response then carries `updated: 0`.
1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1575 def update_ad_campaign_with_http_info(campaign_id, update_ad_campaign_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_campaign ...' end # verify the required parameter 'campaign_id' is set if @api_client.config.client_side_validation && campaign_id.nil? fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.update_ad_campaign" end # verify the required parameter 'update_ad_campaign_request' is set if @api_client.config.client_side_validation && update_ad_campaign_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_campaign_request' when calling AdCampaignsApi.update_ad_campaign" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_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_campaign_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdCampaign200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_campaign", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_set(ad_set_id, update_ad_set_request, opts = {}) ⇒ UpdateAdSet200Response
Update an ad set
Ad-set-level writes. Use this for ABO budget updates, ad-set-scoped pause/resume, bid-strategy edits, Meta value-rule-set attach/detach, and Meta-only post-launch delivery settings via platformSpecificData. At least one updatable field is required. Value rule sets (Meta only, see /v1/ads/value-rule-sets): - ATTACH or REPLACE: send valueRuleSetId. Attachment is driven by the id's presence, so valueRulesApplied: true is optional. Sending a different id replaces the previous association; there is no separate replace call. - DETACH: send valueRulesApplied: false and OMIT valueRuleSetId. - Sending valueRulesApplied: false TOGETHER with valueRuleSetId returns 400 mutually_exclusive_fields. This is deliberate: Meta attaches the rule set whenever value_rule_set_id is present, even with value_rules_applied false, so echoing stored state while asking to detach would silently keep the bid adjustments live. - Eligibility: only ad sets on LOWEST_COST_WITHOUT_CAP or COST_CAP. Meta rejects the rest server-side. - Read back with GET /v1/ads/ad-sets/{adSetId}?fields=value_rule_set_id. Meta does not document value_rules_applied as a readable ad-set field, so the boolean cannot be read back. Bid strategy compatibility (per Meta's spec): - LOWEST_COST_WITHOUT_CAP: no bidAmount, no roasAverageFloor. - LOWEST_COST_WITH_BID_CAP / COST_CAP: bidAmount REQUIRED (whole currency units). - LOWEST_COST_WITH_MIN_ROAS: roasAverageFloor REQUIRED (decimal multiplier, e.g. 2.0 = 2.0x ROAS). - Meta only: send bidAmount WITHOUT bidStrategy to change the cap amount on an ad set under a COST_CAP / LOWEST_COST_WITH_BID_CAP parent campaign, leaving the strategy itself (inherited from the campaign) untouched. roasAverageFloor without bidStrategy is rejected (it has no meaning outside LOWEST_COST_WITH_MIN_ROAS). Delivery settings are validated by Meta against the campaign objective; incompatible combinations (e.g. a billingEvent the optimization goal doesn't allow) surface as 400s from Meta. When updating budget on an ABO campaign: if the parent campaign is CBO, the response is 409 with code BUDGET_LEVEL_MISMATCH — route to PUT /v1/ads/campaigns/campaignId instead.
1712 1713 1714 1715 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1712 def update_ad_set(ad_set_id, update_ad_set_request, opts = {}) data, _status_code, _headers = update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts) data end |
#update_ad_set_status(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ UpdateAdSetStatus200Response
Pause or resume a single ad set
Ad-set-scoped pause/resume (doesn't touch sibling ad sets). Thin wrapper over PUT /v1/ads/ad-sets/adSetId for callers that only want the status toggle and prefer a symmetric URL to /v1/ads/campaigns/campaignId/status. On Meta and LinkedIn this writes the ad set's own on/off switch (Meta: configured_status), whatever delivery status its ads report — an ad still in review does not block resuming its ad set. The echoed status is the confirmation that it landed. Where the platform has no ad-set switch (TikTok and others) the toggle is emulated by flipping the child ads; a call with no actionable ad then writes nothing and returns a message with no status. updated / skipped describe only the ads whose own stored status CHANGED alongside the switch, so updated: 0 is a normal successful response. See skippedReasons for which of the three cases applies (terminal, already in the target state, or switched on but not yet delivering). A campaign created paused needs its campaign resumed as well: pair this with PUT /v1/ads/campaigns/campaignId/status.
1786 1787 1788 1789 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1786 def update_ad_set_status(ad_set_id, update_ad_campaign_status_request, opts = {}) data, _status_code, _headers = update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts) data end |
#update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdSetStatus200Response, Integer, Hash)>
Pause or resume a single ad set Ad-set-scoped pause/resume (doesn't touch sibling ad sets). Thin wrapper over PUT /v1/ads/ad-sets/adSetId for callers that only want the status toggle and prefer a symmetric URL to /v1/ads/campaigns/campaignId/status. On Meta and LinkedIn this writes the ad set's own on/off switch (Meta: `configured_status`), whatever delivery status its ads report — an ad still in review does not block resuming its ad set. The echoed `status` is the confirmation that it landed. Where the platform has no ad-set switch (TikTok and others) the toggle is emulated by flipping the child ads; a call with no actionable ad then writes nothing and returns a `message` with no `status`. `updated` / `skipped` describe only the ads whose own stored status CHANGED alongside the switch, so `updated: 0` is a normal successful response. See `skippedReasons` for which of the three cases applies (terminal, already in the target state, or switched on but not yet delivering). A campaign created paused needs its campaign resumed as well: pair this with PUT /v1/ads/campaigns/campaignId/status.
1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1797 def update_ad_set_status_with_http_info(ad_set_id, update_ad_campaign_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_set_status ...' end # verify the required parameter 'ad_set_id' is set if @api_client.config.client_side_validation && ad_set_id.nil? fail ArgumentError, "Missing the required parameter 'ad_set_id' when calling AdCampaignsApi.update_ad_set_status" end # verify the required parameter 'update_ad_campaign_status_request' is set if @api_client.config.client_side_validation && update_ad_campaign_status_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_campaign_status_request' when calling AdCampaignsApi.update_ad_set_status" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}/status'.sub('{' + 'adSetId' + '}', CGI.escape(ad_set_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_campaign_status_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdSetStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_set_status", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_set_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts = {}) ⇒ Array<(UpdateAdSet200Response, Integer, Hash)>
Update an ad set Ad-set-level writes. Use this for ABO budget updates, ad-set-scoped pause/resume, bid-strategy edits, Meta value-rule-set attach/detach, and Meta-only post-launch delivery settings via `platformSpecificData`. At least one updatable field is required. Value rule sets (Meta only, see `/v1/ads/value-rule-sets`): - ATTACH or REPLACE: send `valueRuleSetId`. Attachment is driven by the id's presence, so `valueRulesApplied: true` is optional. Sending a different id replaces the previous association; there is no separate replace call. - DETACH: send `valueRulesApplied: false` and OMIT `valueRuleSetId`. - Sending `valueRulesApplied: false` TOGETHER with `valueRuleSetId` returns 400 `mutually_exclusive_fields`. This is deliberate: Meta attaches the rule set whenever `value_rule_set_id` is present, even with `value_rules_applied` false, so echoing stored state while asking to detach would silently keep the bid adjustments live. - Eligibility: only ad sets on `LOWEST_COST_WITHOUT_CAP` or `COST_CAP`. Meta rejects the rest server-side. - Read back with `GET /v1/ads/ad-sets/adSetId?fields=value_rule_set_id`. Meta does not document `value_rules_applied` as a readable ad-set field, so the boolean cannot be read back. Bid strategy compatibility (per Meta's spec): - `LOWEST_COST_WITHOUT_CAP`: no `bidAmount`, no `roasAverageFloor`. - `LOWEST_COST_WITH_BID_CAP` / `COST_CAP`: `bidAmount` REQUIRED (whole currency units). - `LOWEST_COST_WITH_MIN_ROAS`: `roasAverageFloor` REQUIRED (decimal multiplier, e.g. 2.0 = 2.0x ROAS). - Meta only: send `bidAmount` WITHOUT `bidStrategy` to change the cap amount on an ad set under a COST_CAP / LOWEST_COST_WITH_BID_CAP parent campaign, leaving the strategy itself (inherited from the campaign) untouched. `roasAverageFloor` without `bidStrategy` is rejected (it has no meaning outside LOWEST_COST_WITH_MIN_ROAS). Delivery settings are validated by Meta against the campaign objective; incompatible combinations (e.g. a billingEvent the optimization goal doesn't allow) surface as 400s from Meta. When updating `budget` on an ABO campaign: if the parent campaign is CBO, the response is 409 with code BUDGET_LEVEL_MISMATCH — route to PUT /v1/ads/campaigns/campaignId instead.
1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1723 def update_ad_set_with_http_info(ad_set_id, update_ad_set_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_set ...' end # verify the required parameter 'ad_set_id' is set if @api_client.config.client_side_validation && ad_set_id.nil? fail ArgumentError, "Missing the required parameter 'ad_set_id' when calling AdCampaignsApi.update_ad_set" end # verify the required parameter 'update_ad_set_request' is set if @api_client.config.client_side_validation && update_ad_set_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_set_request' when calling AdCampaignsApi.update_ad_set" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}'.sub('{' + 'adSetId' + '}', CGI.escape(ad_set_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_set_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdSet200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_set", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_set\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_status(ad_id, update_ad_status_request, opts = {}) ⇒ UpdateAdStatus200Response
Pause or resume a single ad
Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running). Thin wrapper over the status field of PUT /v1/ads/adId, for callers that want a URL symmetric to /v1/ads/campaigns/campaignId/status and /v1/ads/ad-sets/adSetId/status. {adId} accepts the same identifier dialects as GET/PUT /v1/ads/adId (Zernio hex _id, Meta numeric platformAdId, or the creative's effective story/media IDs). platform is inferred from the ad, so it's not required in the body. Ads in terminal statuses (rejected, completed, cancelled) and no-op flips (already in the target state) are skipped.
1860 1861 1862 1863 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1860 def update_ad_status(ad_id, update_ad_status_request, opts = {}) data, _status_code, _headers = update_ad_status_with_http_info(ad_id, update_ad_status_request, opts) data end |
#update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {}) ⇒ Array<(UpdateAdStatus200Response, Integer, Hash)>
Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running). Thin wrapper over the `status` field of PUT /v1/ads/adId, for callers that want a URL symmetric to /v1/ads/campaigns/campaignId/status and /v1/ads/ad-sets/adSetId/status. `adId` accepts the same identifier dialects as GET/PUT /v1/ads/adId (Zernio hex `_id`, Meta numeric `platformAdId`, or the creative's effective story/media IDs). `platform` is inferred from the ad, so it's not required in the body. Ads in terminal statuses (rejected, completed, cancelled) and no-op flips (already in the target state) are skipped.
1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1871 def update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_status ...' 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 AdCampaignsApi.update_ad_status" end # verify the required parameter 'update_ad_status_request' is set if @api_client.config.client_side_validation && update_ad_status_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_status_request' when calling AdCampaignsApi.update_ad_status" end # resource path local_var_path = '/v1/ads/{adId}/status'.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'] # 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_status_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_status", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_with_http_info(ad_id, update_ad_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>
Update ad Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform. Per-platform support: - Meta (Facebook + Instagram): all fields supported. - TikTok: status, budget, targeting (via `/v2/adgroup/update/`), and creative (via `/v2/ad/update/` patch-style — `headline` is ignored, `body` becomes `ad_text`). - Google: status, budget, and KEYWORD edits via `targeting.keywords` / `targeting.negativeKeywords` — each list you send becomes the FULL new set of its kind on the ad group (criteria not in the list are removed); a kind left out is untouched. Any other `targeting` field returns 400: Google cannot mutate broad targeting post-create without recreating the campaign. `creative` returns 501. - Pinterest / X / LinkedIn / OpenAI Ads: status + budget only. Sending `targeting` or `creative` returns 501 with code `unsupported_platform_operation`. OpenAI Ads budget is lifetime-only (see `budget.type` below).
1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1501 def update_ad_with_http_info(ad_id, update_ad_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad ...' 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 AdCampaignsApi.update_ad" end # verify the required parameter 'update_ad_request' is set if @api_client.config.client_side_validation && update_ad_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_request' when calling AdCampaignsApi.update_ad" end # resource path local_var_path = '/v1/ads/{adId}'.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'] # 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_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAd200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |