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
-
#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 (Meta) 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 (Meta) Creates a campaign WITHOUT its first ad set / ad (the ODAX shell only).
-
#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.
-
#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 (Meta) 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 (Meta) Duplicates an ad set, including its ads and creatives by default (`deepCopy: true`), via Meta's native `POST /adset-id/copies`.
-
#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 = {}) ⇒ GetAdTree200Response
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<(GetAdTree200Response, Integer, Hash)>
Get campaign tree Returns a nested Campaign > Ad Set > Ad hierarchy with rolled-up metrics at each level.
-
#get_ads_timeline(account_id, opts = {}) ⇒ GetAdsTimeline200Response
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<(GetAdsTimeline200Response, 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.
-
#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 Updates the status of all ads in a campaign.
-
#update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {}) ⇒ Array<(UpdateAdCampaignStatus200Response, Integer, Hash)>
Pause or resume a campaign Updates the status of all ads in a campaign.
-
#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.
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
#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.
27 28 29 30 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 27 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.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 37 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 (Meta)
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. Meta only.
95 96 97 98 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 95 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 (Meta) 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. Meta only.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 105 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 # 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 # 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 |
#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. Meta-only for now. Other platforms return 501 Not Implemented — fall back to DELETE /v1/ads/adId per ad in the meantime.
164 165 166 167 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 164 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`. Meta-only for now. Other platforms return 501 Not Implemented — fall back to DELETE /v1/ads/adId per ad in the meantime.
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 175 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 |
#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.
238 239 240 241 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 238 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.
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 249 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 # 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 # 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 (Meta)
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). Meta only.
312 313 314 315 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 312 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 (Meta) 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). Meta only.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 323 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 # 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 # 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 |
#get_ad_set_details(ad_set_id, account_id, opts = {}) ⇒ GetAdSetDetails200Response
Live ad-set details incl. learning phase (Meta)
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. Meta only.
387 388 389 390 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 387 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 (Meta) 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. Meta only.
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 399 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 = {}) ⇒ GetAdTree200Response
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.
471 472 473 474 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 471 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<(GetAdTree200Response, 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.
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 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 494 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"] 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 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[:'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[:'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] || 'GetAdTree200Response' # 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_ads_timeline(account_id, opts = {}) ⇒ GetAdsTimeline200Response
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.
593 594 595 596 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 593 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<(GetAdsTimeline200Response, 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.
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 607 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"] 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] || 'GetAdsTimeline200Response' # 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).
678 679 680 681 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 678 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).
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 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 764 765 766 767 768 769 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 697 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"] 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/campaigns' # 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[:'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? # 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 |
#update_ad_campaign(campaign_id, update_ad_campaign_request, opts = {}) ⇒ UpdateAdCampaign200Response
Update a campaign
Campaign-level edits. At least one of budget, bidStrategy, name or platformSpecificData is required. - budget updates the CBO (Campaign Budget Optimization) budget. For ABO campaigns (where the budget lives on the ad set), use PUT /v1/ads/ad-sets/adSetId instead — this endpoint will return 409 with code BUDGET_LEVEL_MISMATCH. - bidStrategy sets the campaign-level default bid strategy. Per Meta's spec, bid_amount and bid_constraints do NOT exist at the campaign level — pass them via PUT /v1/ads/ad-sets/adSetId. - platformSpecificData.spendCap (Meta only) sets the campaign's lifetime spend cap, in the ad account's currency. Meta-only for now. Other platforms return 501 Not Implemented.
777 778 779 780 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 777 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 Updates the status of all ads in a campaign. Makes one platform API call (not per-ad) since status cascades through the campaign hierarchy. Ads in terminal statuses (rejected, completed, cancelled) are automatically skipped.
851 852 853 854 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 851 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 Updates the status of all ads in a campaign. Makes one platform API call (not per-ad) since status cascades through the campaign hierarchy. Ads in terminal statuses (rejected, completed, cancelled) are automatically skipped.
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 862 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. At least one of `budget`, `bidStrategy`, `name` or `platformSpecificData` is required. - `budget` updates the CBO (Campaign Budget Optimization) budget. For ABO campaigns (where the budget lives on the ad set), use PUT /v1/ads/ad-sets/adSetId instead — this endpoint will return 409 with code BUDGET_LEVEL_MISMATCH. - `bidStrategy` sets the campaign-level default bid strategy. Per Meta's spec, `bid_amount` and `bid_constraints` do NOT exist at the campaign level — pass them via PUT /v1/ads/ad-sets/adSetId. - `platformSpecificData.spendCap` (Meta only) sets the campaign's lifetime spend cap, in the ad account's currency. Meta-only for now. Other platforms return 501 Not Implemented.
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 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 788 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, and Meta-only post-launch delivery settings via platformSpecificData. At least one updatable field is required. 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). 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.
925 926 927 928 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 925 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.
999 1000 1001 1002 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 999 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.
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1010 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, and Meta-only post-launch delivery settings via `platformSpecificData`. At least one updatable field is required. 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). 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.
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 936 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 |