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
-
#add_ad_keywords(add_ad_keywords_request, opts = {}) ⇒ AddAdKeywords201Response
Add Search ad-group keywords Adds one or more keyword criteria to an existing Google Search ad group, without touching the keywords already there (unlike the whole-set diff on
PUT /v1/ads/{adId},keywords/negativeKeywordsinplatformSpecificData, which replaces the set). -
#add_ad_keywords_with_http_info(add_ad_keywords_request, opts = {}) ⇒ Array<(AddAdKeywords201Response, Integer, Hash)>
Add Search ad-group keywords Adds one or more keyword criteria to an existing Google Search ad group, without touching the keywords already there (unlike the whole-set diff on `PUT /v1/ads/adId`, `keywords`/`negativeKeywords` in `platformSpecificData`, which replaces the set).
-
#attach_ad_group_assets(ad_set_id, attach_campaign_assets_request, opts = {}) ⇒ AttachAdGroupAssets201Response
Attach ad-group assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
-
#attach_ad_group_assets_with_http_info(ad_set_id, attach_campaign_assets_request, opts = {}) ⇒ Array<(AttachAdGroupAssets201Response, Integer, Hash)>
Attach ad-group assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
-
#attach_campaign_assets(campaign_id, attach_campaign_assets_request, opts = {}) ⇒ AttachCampaignAssets201Response
Attach campaign assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
-
#attach_campaign_assets_with_http_info(campaign_id, attach_campaign_assets_request, opts = {}) ⇒ Array<(AttachCampaignAssets201Response, Integer, Hash)>
Attach campaign assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
-
#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 = {}) ⇒ CreateAdCampaign200Response
Create a standalone campaign Creates a campaign WITHOUT its first ad set / ad, on the platform of the given
accountId. -
#create_ad_campaign_with_http_info(create_ad_campaign_request, opts = {}) ⇒ Array<(CreateAdCampaign200Response, Integer, Hash)>
Create a standalone campaign Creates a campaign WITHOUT its first ad set / ad, on the platform of the given `accountId`.
-
#create_ad_set(create_ad_set_request, opts = {}) ⇒ CreateAdSet201Response
Create a standalone ad group Google Ads compliance row C.190: creates an ad group WITHOUT an ad, under an existing campaign.
-
#create_ad_set_with_http_info(create_ad_set_request, opts = {}) ⇒ Array<(CreateAdSet201Response, Integer, Hash)>
Create a standalone ad group Google Ads compliance row C.190: creates an ad group WITHOUT an ad, under an existing campaign.
-
#create_bid_strategy(create_bid_strategy_request, opts = {}) ⇒ CreateBidStrategy201Response
Create portfolio bid strategy Creates a standalone bid strategy shared across campaigns.
-
#create_bid_strategy_with_http_info(create_bid_strategy_request, opts = {}) ⇒ Array<(CreateBidStrategy201Response, Integer, Hash)>
Create portfolio bid strategy Creates a standalone bid strategy shared across campaigns.
-
#create_standalone_ad(create_standalone_ad_request, opts = {}) ⇒ CreateStandaloneAd200Response
Create standalone ad Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, and OpenAI Ads (ChatGPT Ads).
-
#create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) ⇒ Array<(CreateStandaloneAd200Response, Integer, Hash)>
Create standalone ad Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, 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_set(ad_set_id, opts = {}) ⇒ DeleteAdSet200Response
Delete an ad set Deletes the ad set on the platform, cascading to its ads only (never the campaign).
-
#delete_ad_set_with_http_info(ad_set_id, opts = {}) ⇒ Array<(DeleteAdSet200Response, Integer, Hash)>
Delete an ad set Deletes the ad set on the platform, cascading to its ads only (never the campaign).
-
#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.
-
#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.
-
#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_campaign_details(campaign_id, account_id, opts = {}) ⇒ GetAdCampaignDetails200Response
Get live campaign details Reads one campaign live from Meta, returned verbatim, so a caller that knows a campaign id no longer has to page
GET /v1/ads/campaignsto find it. -
#get_ad_campaign_details_with_http_info(campaign_id, account_id, opts = {}) ⇒ Array<(GetAdCampaignDetails200Response, Integer, Hash)>
Get live campaign details Reads one campaign live from Meta, returned verbatim, so a caller that knows a campaign id no longer has to page `GET /v1/ads/campaigns` to find it.
-
#get_ad_set_details(ad_set_id, account_id, opts = {}) ⇒ GetAdSetDetails200Response
Get live ad-set details Reads the ad set live from Meta, returned verbatim.
-
#get_ad_set_details_with_http_info(ad_set_id, account_id, opts = {}) ⇒ Array<(GetAdSetDetails200Response, Integer, Hash)>
Get live ad-set details Reads the ad set live from Meta, returned verbatim.
-
#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.
-
#get_campaign_ad_schedule(campaign_id, opts = {}) ⇒ GetCampaignAdSchedule200Response
Read a campaign's ad schedule (dayparting) The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them.
-
#get_campaign_ad_schedule_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetCampaignAdSchedule200Response, Integer, Hash)>
Read a campaign's ad schedule (dayparting) The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them.
-
#get_campaign_bidding(campaign_id, account_id, platform, opts = {}) ⇒ GetCampaignBidding200Response
Read a campaign's current bidding Read of the campaign's bidding strategy on Google, cached for the quota window, for pre-filling the bid strategy block before a PUT to /v1/ads/campaigns/campaignId.
-
#get_campaign_bidding_with_http_info(campaign_id, account_id, platform, opts = {}) ⇒ Array<(GetCampaignBidding200Response, Integer, Hash)>
Read a campaign's current bidding Read of the campaign's bidding strategy on Google, cached for the quota window, for pre-filling the bid strategy block before a PUT to /v1/ads/campaigns/campaignId.
-
#get_campaign_targeting(campaign_id, opts = {}) ⇒ GetCampaignTargeting200Response
Read a Google campaign's device, location, and language targeting Google Ads compliance requires geo, language, budget, and bidding targeting set at creation to stay editable afterwards; this reads the campaign state so an integrator can build an editor around it.
-
#get_campaign_targeting_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetCampaignTargeting200Response, Integer, Hash)>
Read a Google campaign's device, location, and language targeting Google Ads compliance requires geo, language, budget, and bidding targeting set at creation to stay editable afterwards; this reads the campaign state so an integrator can build an editor around it.
-
#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_group_assets(ad_set_id, account_id, opts = {}) ⇒ ListAdGroupAssets200Response
List ad-group assets Lists directly attached Google assets.
-
#list_ad_group_assets_with_http_info(ad_set_id, account_id, opts = {}) ⇒ Array<(ListAdGroupAssets200Response, Integer, Hash)>
List ad-group assets Lists directly attached Google assets.
-
#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_ad_sets(opts = {}) ⇒ ListAdSets200Response
List ad sets Ad sets (Google ad groups) synced for the connection, optionally filtered by platform and campaignId.
-
#list_ad_sets_with_http_info(opts = {}) ⇒ Array<(ListAdSets200Response, Integer, Hash)>
List ad sets Ad sets (Google ad groups) synced for the connection, optionally filtered by platform and campaignId.
-
#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.
-
#list_bid_strategies(account_id, opts = {}) ⇒ ListBidStrategies200Response
List portfolio bid strategies Bidding strategy report: type, status, campaign count, clicks, cost, cost per conversion, impressions, average CPC and conversions over the date range (default last 30 days).
-
#list_bid_strategies_with_http_info(account_id, opts = {}) ⇒ Array<(ListBidStrategies200Response, Integer, Hash)>
List portfolio bid strategies Bidding strategy report: type, status, campaign count, clicks, cost, cost per conversion, impressions, average CPC and conversions over the date range (default last 30 days).
-
#list_campaign_assets(campaign_id, account_id, opts = {}) ⇒ ListCampaignAssets200Response
List campaign assets Lists directly attached Google assets.
-
#list_campaign_assets_with_http_info(campaign_id, account_id, opts = {}) ⇒ Array<(ListCampaignAssets200Response, Integer, Hash)>
List campaign assets Lists directly attached Google assets.
-
#list_campaign_negative_keyword_lists(campaign_id, opts = {}) ⇒ ListAdNegativeKeywordLists200Response
List campaign negative lists Returns shared negative keyword lists attached to the campaign, separate from campaign-level negative keywords.
-
#list_campaign_negative_keyword_lists_with_http_info(campaign_id, opts = {}) ⇒ Array<(ListAdNegativeKeywordLists200Response, Integer, Hash)>
List campaign negative lists Returns shared negative keyword lists attached to the campaign, separate from campaign-level negative keywords.
-
#list_campaign_negative_keywords(campaign_id, opts = {}) ⇒ ListCampaignNegativeKeywords200Response
List campaign-level negative keywords Returns the campaign-level negative keywords (
campaign_criterion.negative), distinct from the ad-group-level negatives underGET /v1/ads/keywords. -
#list_campaign_negative_keywords_with_http_info(campaign_id, opts = {}) ⇒ Array<(ListCampaignNegativeKeywords200Response, Integer, Hash)>
List campaign-level negative keywords Returns the campaign-level negative keywords (`campaign_criterion.negative`), distinct from the ad-group-level negatives under `GET /v1/ads/keywords`.
-
#list_google_asset_groups(campaign_id, opts = {}) ⇒ ListGoogleAssetGroups200Response
List Performance Max asset groups Read Performance Max asset groups and their linked text, image and YouTube assets.
-
#list_google_asset_groups_with_http_info(campaign_id, opts = {}) ⇒ Array<(ListGoogleAssetGroups200Response, Integer, Hash)>
List Performance Max asset groups Read Performance Max asset groups and their linked text, image and YouTube assets.
-
#remove_ad_group_assets(ad_set_id, remove_ad_group_assets_request, opts = {}) ⇒ RemoveCampaignAssets200Response
Remove ad-group assets Removes the specified attachments only.
-
#remove_ad_group_assets_with_http_info(ad_set_id, remove_ad_group_assets_request, opts = {}) ⇒ Array<(RemoveCampaignAssets200Response, Integer, Hash)>
Remove ad-group assets Removes the specified attachments only.
-
#remove_ad_keyword(keyword_id, opts = {}) ⇒ RemoveAdKeyword200Response
Remove a Search keyword Removes one keyword criterion (positive or negative) from its ad group (M.140).
-
#remove_ad_keyword_with_http_info(keyword_id, opts = {}) ⇒ Array<(RemoveAdKeyword200Response, Integer, Hash)>
Remove a Search keyword Removes one keyword criterion (positive or negative) from its ad group (M.140).
-
#remove_campaign_assets(campaign_id, remove_campaign_assets_request, opts = {}) ⇒ RemoveCampaignAssets200Response
Remove campaign assets Removes the specified attachments only.
-
#remove_campaign_assets_with_http_info(campaign_id, remove_campaign_assets_request, opts = {}) ⇒ Array<(RemoveCampaignAssets200Response, Integer, Hash)>
Remove campaign assets Removes the specified attachments only.
-
#replace_campaign_negative_keyword_lists(campaign_id, replace_campaign_negative_keyword_lists_request, opts = {}) ⇒ ReplaceAdNegativeKeywordListKeywords200Response
Replace campaign negative lists Sets the full desired set of shared negative keyword list associations on this campaign.
-
#replace_campaign_negative_keyword_lists_with_http_info(campaign_id, replace_campaign_negative_keyword_lists_request, opts = {}) ⇒ Array<(ReplaceAdNegativeKeywordListKeywords200Response, Integer, Hash)>
Replace campaign negative lists Sets the full desired set of shared negative keyword list associations on this campaign.
-
#replace_campaign_negative_keywords(campaign_id, replace_campaign_negative_keywords_request, opts = {}) ⇒ ReplaceCampaignNegativeKeywords200Response
Replace campaign-level negative keywords Replaces the FULL set of campaign-level negative keywords (C.270): the desired list is diffed against what Google already has, and the difference is applied as one
create/removemutate. -
#replace_campaign_negative_keywords_with_http_info(campaign_id, replace_campaign_negative_keywords_request, opts = {}) ⇒ Array<(ReplaceCampaignNegativeKeywords200Response, Integer, Hash)>
Replace campaign-level negative keywords Replaces the FULL set of campaign-level negative keywords (C.270): the desired list is diffed against what Google already has, and the difference is applied as one `create`/`remove` mutate.
-
#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_group_assets(ad_set_id, update_campaign_assets_request, opts = {}) ⇒ UpdateCampaignAssets200Response
Update ad-group assets Edits existing Google assets in place.
-
#update_ad_group_assets_with_http_info(ad_set_id, update_campaign_assets_request, opts = {}) ⇒ Array<(UpdateCampaignAssets200Response, Integer, Hash)>
Update ad-group assets Edits existing Google assets in place.
-
#update_ad_keyword(keyword_id, update_ad_keyword_request, opts = {}) ⇒ UpdateAdKeyword200Response
Pause or enable a Search keyword Changes
ad_group_criterion.statusfor one keyword criterion (M.140). -
#update_ad_keyword_with_http_info(keyword_id, update_ad_keyword_request, opts = {}) ⇒ Array<(UpdateAdKeyword200Response, Integer, Hash)>
Pause or enable a Search keyword Changes `ad_group_criterion.status` for one keyword criterion (M.140).
-
#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_keyword_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_keyword_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.
-
#update_bid_strategy(strategy_id, update_bid_strategy_request, opts = {}) ⇒ UpdateBidStrategy200Response
Update portfolio bid strategy Renames or retargets a portfolio bid strategy.
-
#update_bid_strategy_with_http_info(strategy_id, update_bid_strategy_request, opts = {}) ⇒ Array<(UpdateBidStrategy200Response, Integer, Hash)>
Update portfolio bid strategy Renames or retargets a portfolio bid strategy.
-
#update_campaign_ad_schedule(campaign_id, update_campaign_ad_schedule_request, opts = {}) ⇒ UpdateCampaignAdSchedule200Response
Replace a campaign's ad schedule (dayparting) Replaces the campaign's whole ad schedule with the windows you send.
-
#update_campaign_ad_schedule_with_http_info(campaign_id, update_campaign_ad_schedule_request, opts = {}) ⇒ Array<(UpdateCampaignAdSchedule200Response, Integer, Hash)>
Replace a campaign's ad schedule (dayparting) Replaces the campaign's whole ad schedule with the windows you send.
-
#update_campaign_assets(campaign_id, update_campaign_assets_request, opts = {}) ⇒ UpdateCampaignAssets200Response
Update campaign assets Edits existing Google assets in place.
-
#update_campaign_assets_with_http_info(campaign_id, update_campaign_assets_request, opts = {}) ⇒ Array<(UpdateCampaignAssets200Response, Integer, Hash)>
Update campaign assets Edits existing Google assets in place.
-
#update_campaign_targeting(campaign_id, update_campaign_targeting_request, opts = {}) ⇒ UpdateCampaignTargeting200Response
Edit a Google campaign's device, location, or language targeting Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards.
-
#update_campaign_targeting_with_http_info(campaign_id, update_campaign_targeting_request, opts = {}) ⇒ Array<(UpdateCampaignTargeting200Response, Integer, Hash)>
Edit a Google campaign's device, location, or language targeting Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards.
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
#add_ad_keywords(add_ad_keywords_request, opts = {}) ⇒ AddAdKeywords201Response
Add Search ad-group keywords
Adds one or more keyword criteria to an existing Google Search ad group, without touching the keywords already there (unlike the whole-set diff on PUT /v1/ads/{adId}, keywords/negativeKeywords in platformSpecificData, which replaces the set). Set negative: true to add ad-group-level negatives instead of positive keywords.
27 28 29 30 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 27 def add_ad_keywords(add_ad_keywords_request, opts = {}) data, _status_code, _headers = add_ad_keywords_with_http_info(add_ad_keywords_request, opts) data end |
#add_ad_keywords_with_http_info(add_ad_keywords_request, opts = {}) ⇒ Array<(AddAdKeywords201Response, Integer, Hash)>
Add Search ad-group keywords Adds one or more keyword criteria to an existing Google Search ad group, without touching the keywords already there (unlike the whole-set diff on `PUT /v1/ads/adId`, `keywords`/`negativeKeywords` in `platformSpecificData`, which replaces the set). Set `negative: true` to add ad-group-level negatives instead of positive keywords.
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 add_ad_keywords_with_http_info(add_ad_keywords_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.add_ad_keywords ...' end # verify the required parameter 'add_ad_keywords_request' is set if @api_client.config.client_side_validation && add_ad_keywords_request.nil? fail ArgumentError, "Missing the required parameter 'add_ad_keywords_request' when calling AdCampaignsApi.add_ad_keywords" end # resource path local_var_path = '/v1/ads/keywords' # 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(add_ad_keywords_request) # return_type return_type = opts[:debug_return_type] || 'AddAdKeywords201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.add_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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#add_ad_keywords\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#attach_ad_group_assets(ad_set_id, attach_campaign_assets_request, opts = {}) ⇒ AttachAdGroupAssets201Response
Attach ad-group assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
96 97 98 99 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 96 def attach_ad_group_assets(ad_set_id, attach_campaign_assets_request, opts = {}) data, _status_code, _headers = attach_ad_group_assets_with_http_info(ad_set_id, attach_campaign_assets_request, opts) data end |
#attach_ad_group_assets_with_http_info(ad_set_id, attach_campaign_assets_request, opts = {}) ⇒ Array<(AttachAdGroupAssets201Response, Integer, Hash)>
Attach ad-group assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 107 def attach_ad_group_assets_with_http_info(ad_set_id, attach_campaign_assets_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.attach_ad_group_assets ...' 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.attach_ad_group_assets" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_set_id !~ pattern fail ArgumentError, "invalid value for 'ad_set_id' when calling AdCampaignsApi.attach_ad_group_assets, must conform to the pattern #{pattern}." 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_ad_group_assets" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}/assets'.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(attach_campaign_assets_request) # return_type return_type = opts[:debug_return_type] || 'AttachAdGroupAssets201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.attach_ad_group_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_ad_group_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#attach_campaign_assets(campaign_id, attach_campaign_assets_request, opts = {}) ⇒ AttachCampaignAssets201Response
Attach campaign assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
175 176 177 178 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 175 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 campaign assets Creates and attaches sitelinks, callouts and structured snippets in one Google mutation.
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 238 239 240 241 242 243 244 245 246 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 186 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 pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && campaign_id !~ pattern fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.attach_campaign_assets, must conform to the pattern #{pattern}." 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, whatsappPhoneNumber and adSetId are Meta-only and return 400 on other platforms. accountId may be a Facebook, Instagram or Meta ads (business login) connection. A business-login connection has no posting account, so pass the post as platformPostId (Facebook pageId_postId or an Instagram media id); a Zernio postId is a 400 there. Messaging boosts (Meta). Use goal: engagement with callToAction: WHATSAPP_MESSAGE, MESSAGE_PAGE, or INSTAGRAM_MESSAGE. The CTA implies WHATSAPP, MESSENGER, or INSTAGRAM_DIRECT respectively; destinationType alone does not select a messaging CTA. Omit linkUrl only for messaging CTAs. Plain link CTAs keep their goal and link behavior when combined with an independent destinationType. The campaign uses OUTCOME_ENGAGEMENT and the ad set uses CONVERSATIONS with the promoted Page. Optional whatsappPhoneNumber selects a number already paired with that Page. Conflicting CTA/destination, instant form, goal, or optimizationGoal inputs return 400. Attach requires the target ad set destination to match. Existing post references preserve social proof; an Instagram reel rejected by Meta is not re-uploaded as a new post for a messaging boost. 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).
254 255 256 257 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 254 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`, `whatsappPhoneNumber` and `adSetId` are Meta-only and return 400 on other platforms. `accountId` may be a Facebook, Instagram or Meta ads (business login) connection. A business-login connection has no posting account, so pass the post as `platformPostId` (Facebook `pageId_postId` or an Instagram media id); a Zernio `postId` is a 400 there. Messaging boosts (Meta). Use `goal: engagement` with `callToAction: WHATSAPP_MESSAGE`, `MESSAGE_PAGE`, or `INSTAGRAM_MESSAGE`. The CTA implies WHATSAPP, MESSENGER, or INSTAGRAM_DIRECT respectively; `destinationType` alone does not select a messaging CTA. Omit `linkUrl` only for messaging CTAs. Plain link CTAs keep their goal and link behavior when combined with an independent `destinationType`. The campaign uses OUTCOME_ENGAGEMENT and the ad set uses CONVERSATIONS with the promoted Page. Optional `whatsappPhoneNumber` selects a number already paired with that Page. Conflicting CTA/destination, instant form, goal, or optimizationGoal inputs return 400. Attach requires the target ad set destination to match. Existing post references preserve social proof; an Instagram reel rejected by Meta is not re-uploaded as a new post for a messaging boost. 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).
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 313 314 315 316 317 318 319 320 321 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 265 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.
328 329 330 331 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 328 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.
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 388 389 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 338 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 = {}) ⇒ CreateAdCampaign200Response
Create a standalone campaign
Creates a campaign WITHOUT its first ad set / ad, on the platform of the given accountId. Ad sets join it later via existingCampaignId on the create endpoints. Platform notes: on Meta a budget here is campaign-level (CBO) by definition; omit it for ABO (each ad set carries its own budget), and specialAdCategories is Meta-only (400 elsewhere); bidStrategy is Meta and Google (400 elsewhere), and Google also accepts portfolioBidStrategyId instead. Google, X and OpenAI require a budget (422 without one; OpenAI accepts daily or lifetime, Google only budgetType: daily). On OpenAI goal sets the campaign objective, and conversions needs an active standard conversion event on the account. LinkedIn creates the campaign GROUP (our campaign level) and rejects a budget, which lives on the campaign (ad set) level there; it comes back status: DRAFT. TikTok campaigns are created without a status and report ENABLE. Created PAUSED unless status: ACTIVE where the platform supports it. Idempotency: send an Idempotency-Key header to make retries safe.
397 398 399 400 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 397 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<(CreateAdCampaign200Response, Integer, Hash)>
Create a standalone campaign Creates a campaign WITHOUT its first ad set / ad, on the platform of the given `accountId`. Ad sets join it later via `existingCampaignId` on the create endpoints. Platform notes: on Meta a budget here is campaign-level (CBO) by definition; omit it for ABO (each ad set carries its own budget), and `specialAdCategories` is Meta-only (400 elsewhere); `bidStrategy` is Meta and Google (400 elsewhere), and Google also accepts `portfolioBidStrategyId` instead. Google, X and OpenAI require a budget (422 without one; OpenAI accepts daily or lifetime, Google only `budgetType: daily`). On OpenAI `goal` sets the campaign objective, and `conversions` needs an active standard conversion event on the account. LinkedIn creates the campaign GROUP (our campaign level) and rejects a budget, which lives on the campaign (ad set) level there; it comes back `status: DRAFT`. TikTok campaigns are created without a status and report `ENABLE`. Created `PAUSED` unless `status: ACTIVE` where the platform supports it. Idempotency: send an `Idempotency-Key` header to make retries safe.
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 452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 408 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] || 'CreateAdCampaign200Response' # 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_ad_set(create_ad_set_request, opts = {}) ⇒ CreateAdSet201Response
Create a standalone ad group
Google Ads compliance row C.190: creates an ad group WITHOUT an ad, under an existing campaign. Ads join it later via adSetId on POST /v1/ads/create. Google only; every other platform returns 501. Created PAUSED unless status: ACTIVE. The new ad group has no ad yet, so it will not appear in GET /v1/ads/tree (built purely from ads rows) until one is added; use GET /v1/ads/ad-sets to see it in the meantime. Idempotency: send an Idempotency-Key header to make retries safe.
472 473 474 475 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 472 def create_ad_set(create_ad_set_request, opts = {}) data, _status_code, _headers = create_ad_set_with_http_info(create_ad_set_request, opts) data end |
#create_ad_set_with_http_info(create_ad_set_request, opts = {}) ⇒ Array<(CreateAdSet201Response, Integer, Hash)>
Create a standalone ad group Google Ads compliance row C.190: creates an ad group WITHOUT an ad, under an existing campaign. Ads join it later via `adSetId` on POST /v1/ads/create. Google only; every other platform returns 501. Created `PAUSED` unless `status: ACTIVE`. The new ad group has no ad yet, so it will not appear in GET /v1/ads/tree (built purely from `ads` rows) until one is added; use GET /v1/ads/ad-sets to see it in the meantime. Idempotency: send an `Idempotency-Key` header to make retries safe.
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 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 483 def create_ad_set_with_http_info(create_ad_set_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.create_ad_set ...' end # verify the required parameter 'create_ad_set_request' is set if @api_client.config.client_side_validation && create_ad_set_request.nil? fail ArgumentError, "Missing the required parameter 'create_ad_set_request' when calling AdCampaignsApi.create_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.create_ad_set, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/v1/ads/ad-sets' # 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_set_request) # return_type return_type = opts[:debug_return_type] || 'CreateAdSet201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.create_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#create_ad_set\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_bid_strategy(create_bid_strategy_request, opts = {}) ⇒ CreateBidStrategy201Response
Create portfolio bid strategy
Creates a standalone bid strategy shared across campaigns. Attach it to a campaign with portfolioBidStrategyId on POST /v1/ads/create, PUT /v1/ads/campaigns/campaignId, or PUT /v1/ads/ad-sets/adSetId. Attaching a strategy aligned to a shared budget fails there with a 400 (Google's BIDDING_STRATEGY_AND_BUDGET_MUST_BE_ALIGNED); this is not retryable.
546 547 548 549 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 546 def create_bid_strategy(create_bid_strategy_request, opts = {}) data, _status_code, _headers = create_bid_strategy_with_http_info(create_bid_strategy_request, opts) data end |
#create_bid_strategy_with_http_info(create_bid_strategy_request, opts = {}) ⇒ Array<(CreateBidStrategy201Response, Integer, Hash)>
Create portfolio bid strategy Creates a standalone bid strategy shared across campaigns. Attach it to a campaign with `portfolioBidStrategyId` on POST /v1/ads/create, PUT /v1/ads/campaigns/campaignId, or PUT /v1/ads/ad-sets/adSetId. Attaching a strategy aligned to a shared budget fails there with a 400 (Google's `BIDDING_STRATEGY_AND_BUDGET_MUST_BE_ALIGNED`); this is not retryable.
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 602 603 604 605 606 607 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 556 def create_bid_strategy_with_http_info(create_bid_strategy_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.create_bid_strategy ...' end # verify the required parameter 'create_bid_strategy_request' is set if @api_client.config.client_side_validation && create_bid_strategy_request.nil? fail ArgumentError, "Missing the required parameter 'create_bid_strategy_request' when calling AdCampaignsApi.create_bid_strategy" end # resource path local_var_path = '/v1/ads/bid-strategies' # 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_bid_strategy_request) # return_type return_type = opts[:debug_return_type] || 'CreateBidStrategy201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.create_bid_strategy", :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_bid_strategy\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
Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, and OpenAI Ads (ChatGPT Ads). Google Performance Max: set campaignType: \"pmax\" and supply assetGroup with text, images by role, business name and finalUrl. Creates a daily budget, PAUSED campaign and asset group atomically. validateOnly: true validates the complete request with Google without creating or persisting resources. Read assets with GET /v1/ads/campaigns/{campaignId}/asset-groups. The logo is required; video is optional via assetGroup.youtubeVideoId. Brand guidelines are disabled at creation. All supplied asset links are validated together against Google's minimum asset requirements. PMax rejects ACTIVE creation, portfolio bidding, bid caps, legacy creative fields and attach shapes. Geo and language targeting are supported; omitted geo targets all locations. PMax does not require top-level goal, headline, body or linkUrl. Supported bidding: omitted or LOWEST_COST_WITHOUT_CAP for Maximize Conversions, COST_CAP plus bidAmount for target CPA, LOWEST_COST_WITH_MIN_ROAS plus roasAverageFloor for Maximize Conversion Value with target ROAS. Other mutually-exclusive request shapes are selected by the body: - Legacy single-creative shape (all platforms, the default). - Meta-only multi-creative shape via the creatives array: one ad set with N ads sharing budget and targeting. - Attach shape via adSetId: adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, Google Ads, TikTok, and LinkedIn). On LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted. On LinkedIn goal may be omitted too (taken from the Campaign's objective), and the created ad's targeting echoes the Campaign's audience. Meta accepts creativeFeatures on the single and attach shapes and as defaults for creatives[]; an item replaces the whole feature map. promotion is not supported on any shape and any object is rejected with 400. Reusing existingCreativeId uses the existing creative settings instead of new settings. Requested settings are persisted for lists, exports, and default ad-detail reads. 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.
615 616 617 618 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 615 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 Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, and OpenAI Ads (ChatGPT Ads). Google Performance Max: set `campaignType: "pmax"` and supply `assetGroup` with text, images by role, business name and finalUrl. Creates a daily budget, PAUSED campaign and asset group atomically. `validateOnly: true` validates the complete request with Google without creating or persisting resources. Read assets with `GET /v1/ads/campaigns/campaignId/asset-groups`. The logo is required; video is optional via `assetGroup.youtubeVideoId`. Brand guidelines are disabled at creation. All supplied asset links are validated together against Google's minimum asset requirements. PMax rejects ACTIVE creation, portfolio bidding, bid caps, legacy creative fields and attach shapes. Geo and language targeting are supported; omitted geo targets all locations. PMax does not require top-level goal, headline, body or linkUrl. Supported bidding: omitted or LOWEST_COST_WITHOUT_CAP for Maximize Conversions, COST_CAP plus bidAmount for target CPA, LOWEST_COST_WITH_MIN_ROAS plus roasAverageFloor for Maximize Conversion Value with target ROAS. Other mutually-exclusive request shapes are selected by the body: - Legacy single-creative shape (all platforms, the default). - Meta-only multi-creative shape via the creatives array: one ad set with N ads sharing budget and targeting. - Attach shape via adSetId: adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, Google Ads, TikTok, and LinkedIn). On LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted. On LinkedIn `goal` may be omitted too (taken from the Campaign's objective), and the created ad's `targeting` echoes the Campaign's audience. Meta accepts `creativeFeatures` on the single and attach shapes and as defaults for `creatives`; an item replaces the whole feature map. `promotion` is not supported on any shape and any object is rejected with 400. Reusing `existingCreativeId` uses the existing creative settings instead of new settings. Requested settings are persisted for lists, exports, and default ad-detail reads. 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.
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 626 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).
689 690 691 692 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 689 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.
753 754 755 756 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 753 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.
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 764 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_set(ad_set_id, opts = {}) ⇒ DeleteAdSet200Response
Delete an ad set
Deletes the ad set on the platform, cascading to its ads only (never the campaign). Locally, every Ad document under the ad set is marked status: cancelled. Delete is soft on platforms that have no hard delete: LinkedIn moves the campaign to PENDING_DELETION, Pinterest archives the ad group, and X soft-flags the line item. Google removes the ad group. All remain readable for reporting.
826 827 828 829 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 826 def delete_ad_set(ad_set_id, opts = {}) data, _status_code, _headers = delete_ad_set_with_http_info(ad_set_id, opts) data end |
#delete_ad_set_with_http_info(ad_set_id, opts = {}) ⇒ Array<(DeleteAdSet200Response, Integer, Hash)>
Delete an ad set Deletes the ad set on the platform, cascading to its ads only (never the campaign). Locally, every Ad document under the ad set is marked `status: cancelled`. Delete is soft on platforms that have no hard delete: LinkedIn moves the campaign to `PENDING_DELETION`, Pinterest archives the ad group, and X soft-flags the line item. Google removes the ad group. All remain readable for reporting.
836 837 838 839 840 841 842 843 844 845 846 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 836 def delete_ad_set_with_http_info(ad_set_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.delete_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.delete_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'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DeleteAdSet200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.delete_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(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#delete_ad_set\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).
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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 699 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). Creative settings returned by Meta, including explicit promotion metadata and creativeFeatures, are preserved when the native copy requires a creative rebuild. Metadata Meta does not return cannot be recovered. When Meta refuses the native copy with its capability error (code 3), which happens for some creatives built by other tools, the ad is rebuilt instead: a new creative from the source's returned spec and a new ad in the target ad set, carrying the source name, status option, rename options and tracking specs.
891 892 893 894 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 891 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, and 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.
968 969 970 971 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 968 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, and 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.
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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 980 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. The copy is created paused so callers can review before launching. campaignId retargets the copy into another campaign; omitted = the source's own campaign. Meta: ads and creatives are included by default (deepCopy: true) via Meta's native POST /{adset-id}/copies; the new hierarchy materializes asynchronously and sync discovery is triggered automatically (syncAfter: false to skip). TikTok: the ad group is read and recreated under the campaign with its targeting, bidding, budget and schedule (start reset to now); deepCopy: true recreates its ads too (default false). startTime, endTime and renameStrategy are ignored and statusOption must be PAUSED or absent. The copy appears on the next discovery sync.
1049 1050 1051 1052 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1049 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. The copy is created paused so callers can review before launching. `campaignId` retargets the copy into another campaign; omitted = the source's own campaign. Meta: ads and creatives are included by default (`deepCopy: true`) via Meta's native `POST /adset-id/copies`; the new hierarchy materializes asynchronously and sync discovery is triggered automatically (`syncAfter: false` to skip). TikTok: the ad group is read and recreated under the campaign with its targeting, bidding, budget and schedule (start reset to now); `deepCopy: true` recreates its ads too (default false). `startTime`, `endTime` and `renameStrategy` are ignored and `statusOption` must be PAUSED or absent. The copy appears on the next discovery sync.
1061 1062 1063 1064 1065 1066 1067 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1061 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). Creative settings returned by Meta, including explicit promotion metadata and creativeFeatures, are preserved when the native copy requires a creative rebuild. Metadata Meta does not return cannot be recovered. When Meta refuses the native copy with its capability error (code 3), which happens for some creatives built by other tools, the ad is rebuilt instead: a new creative from the source's returned spec and a new ad in the target ad set, carrying the source name, status option, rename options and tracking specs.
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 903 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. Google Search ads include current creative.headlines, creative.descriptions and creative.finalUrls, preserving pinnedField. Top-level cachedAt and stale report cache freshness. Google mutations invalidate this read. RSA enrichment requires a stored advertisingChannelType of SEARCH. Ads with an unknown or other channel return their stored details without a Google read. If RSA enrichment fails, the stored ad is returned with HTTP 200 and without cache metadata. 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. creative.creativeFeatures holds the stored requested settings, which do not confirm platform application.
1128 1129 1130 1131 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1128 def get_ad(ad_id, opts = {}) data, _status_code, _headers = get_ad_with_http_info(ad_id, opts) data end |
#get_ad_campaign_details(campaign_id, account_id, opts = {}) ⇒ GetAdCampaignDetails200Response
Get live campaign details
Reads one campaign live from Meta, returned verbatim, so a caller that knows a campaign id no longer has to page GET /v1/ads/campaigns to find it. The default projection covers name, status, objective, buying type, bid strategy, budgets, spend cap, schedule and issues_info. fields is a raw-passthrough override; unknown fields return Meta's 400 verbatim. A campaign the resolved connection cannot see comes back as Meta's own 400, not a 404.
1193 1194 1195 1196 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1193 def get_ad_campaign_details(campaign_id, account_id, opts = {}) data, _status_code, _headers = get_ad_campaign_details_with_http_info(campaign_id, account_id, opts) data end |
#get_ad_campaign_details_with_http_info(campaign_id, account_id, opts = {}) ⇒ Array<(GetAdCampaignDetails200Response, Integer, Hash)>
Get live campaign details Reads one campaign live from Meta, returned verbatim, so a caller that knows a campaign id no longer has to page `GET /v1/ads/campaigns` to find it. The default projection covers name, status, objective, buying type, bid strategy, budgets, spend cap, schedule and `issues_info`. `fields` is a raw-passthrough override; unknown fields return Meta's 400 verbatim. A campaign the resolved connection cannot see comes back as Meta's own 400, not a 404.
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 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1205 def get_ad_campaign_details_with_http_info(campaign_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_ad_campaign_details ...' 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.get_ad_campaign_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_campaign_details" 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] || {} 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] || 'GetAdCampaignDetails200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_ad_campaign_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_campaign_details\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
Get live ad-set details
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.
1266 1267 1268 1269 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1266 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)>
Get live ad-set details 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.
1278 1279 1280 1281 1282 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1278 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.
1353 1354 1355 1356 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1353 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.
1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1379 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. Google Search ads include current creative.headlines, creative.descriptions and creative.finalUrls, preserving pinnedField. Top-level cachedAt and stale report cache freshness. Google mutations invalidate this read. RSA enrichment requires a stored advertisingChannelType of SEARCH. Ads with an unknown or other channel return their stored details without a Google read. If RSA enrichment fails, the stored ad is returned with HTTP 200 and without cache metadata. 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. `creative.creativeFeatures` holds the stored requested settings, which do not confirm platform application.
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1138 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), the 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. With adAccountId set to a Google customer id this is the customer-level performance report (clicks, cost, impressions, conversions, all conversions per day).
1485 1486 1487 1488 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1485 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), the 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. With adAccountId set to a Google customer id this is the customer-level performance report (clicks, cost, impressions, conversions, all conversions per day).
1499 1500 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1499 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 |
#get_campaign_ad_schedule(campaign_id, opts = {}) ⇒ GetCampaignAdSchedule200Response
Read a campaign's ad schedule (dayparting)
The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them. An EMPTY schedule is meaningful and is not a failed lookup: Google has no "all day" criterion, so a campaign with no ad schedule serves around the clock. servesAroundTheClock states that explicitly. Set includePerformance=true to also get delivery split by day of week and by hour, which is the evidence for deciding what the schedule should be. It is one extra Google call segmented by both dimensions at once, so the two views always agree. Google Ads only. The response carries cachedAt and stale, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
1566 1567 1568 1569 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1566 def get_campaign_ad_schedule(campaign_id, opts = {}) data, _status_code, _headers = get_campaign_ad_schedule_with_http_info(campaign_id, opts) data end |
#get_campaign_ad_schedule_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetCampaignAdSchedule200Response, Integer, Hash)>
Read a campaign's ad schedule (dayparting) The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them. An EMPTY `schedule` is meaningful and is not a failed lookup: Google has no "all day" criterion, so a campaign with no ad schedule serves around the clock. `servesAroundTheClock` states that explicitly. Set `includePerformance=true` to also get delivery split by day of week and by hour, which is the evidence for deciding what the schedule should be. It is one extra Google call segmented by both dimensions at once, so the two views always agree. Google Ads only. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
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 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1581 def get_campaign_ad_schedule_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_campaign_ad_schedule ...' 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.get_campaign_ad_schedule" end allowable_values = ["google"] 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[:'window_days'].nil? && opts[:'window_days'] > 90 fail ArgumentError, 'invalid value for "opts[:"window_days"]" when calling AdCampaignsApi.get_campaign_ad_schedule, must be smaller than or equal to 90.' end if @api_client.config.client_side_validation && !opts[:'window_days'].nil? && opts[:'window_days'] < 1 fail ArgumentError, 'invalid value for "opts[:"window_days"]" when calling AdCampaignsApi.get_campaign_ad_schedule, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/ad-schedule'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil? query_params[:'includePerformance'] = opts[:'include_performance'] if !opts[:'include_performance'].nil? query_params[:'windowDays'] = opts[:'window_days'] if !opts[:'window_days'].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] || 'GetCampaignAdSchedule200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_campaign_ad_schedule", :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_campaign_ad_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_campaign_bidding(campaign_id, account_id, platform, opts = {}) ⇒ GetCampaignBidding200Response
Read a campaign's current bidding
Read of the campaign's bidding strategy on Google, cached for the quota window, for pre-filling the bid strategy block before a PUT to /v1/ads/campaigns/campaignId. Google Ads only; platform is required and rejected when it is anything else, since a campaignId is not globally unique. The response carries cachedAt and stale, set when a quota-exhausted call falls back to the last-good copy instead of a live read. Maps Google's bidding strategy onto the same triplet PUT accepts: LOWEST_COST_WITHOUT_CAP (Maximize Conversions, no target), COST_CAP + bidAmount (Target CPA), LOWEST_COST_WITH_MIN_ROAS + roasAverageFloor (Target ROAS), LOWEST_COST_WITH_BID_CAP + bidAmount (Maximize Clicks with a CPC ceiling). A campaign on a portfolio strategy returns portfolio (id + name) and bidSpec.portfolioBidStrategyId instead of the triplet. Anything else (Manual CPC, Target Impression Share, ...) returns bidSpec: null; show biddingStrategyType as-is.
1655 1656 1657 1658 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1655 def get_campaign_bidding(campaign_id, account_id, platform, opts = {}) data, _status_code, _headers = get_campaign_bidding_with_http_info(campaign_id, account_id, platform, opts) data end |
#get_campaign_bidding_with_http_info(campaign_id, account_id, platform, opts = {}) ⇒ Array<(GetCampaignBidding200Response, Integer, Hash)>
Read a campaign's current bidding Read of the campaign's bidding strategy on Google, cached for the quota window, for pre-filling the bid strategy block before a PUT to /v1/ads/campaigns/campaignId. Google Ads only; `platform` is required and rejected when it is anything else, since a `campaignId` is not globally unique. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read. Maps Google's bidding strategy onto the same triplet PUT accepts: `LOWEST_COST_WITHOUT_CAP` (Maximize Conversions, no target), `COST_CAP` + `bidAmount` (Target CPA), `LOWEST_COST_WITH_MIN_ROAS` + `roasAverageFloor` (Target ROAS), `LOWEST_COST_WITH_BID_CAP` + `bidAmount` (Maximize Clicks with a CPC ceiling). A campaign on a portfolio strategy returns `portfolio` (id + name) and `bidSpec.portfolioBidStrategyId` instead of the triplet. Anything else (Manual CPC, Target Impression Share, ...) returns `bidSpec: null`; show `biddingStrategyType` as-is.
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 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1669 def get_campaign_bidding_with_http_info(campaign_id, account_id, platform, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_campaign_bidding ...' 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.get_campaign_bidding" 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_campaign_bidding" end # verify the required parameter 'platform' is set if @api_client.config.client_side_validation && platform.nil? fail ArgumentError, "Missing the required parameter 'platform' when calling AdCampaignsApi.get_campaign_bidding" end # verify enum value allowable_values = ["google"] if @api_client.config.client_side_validation && !allowable_values.include?(platform) fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/bidding'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'platform'] = platform query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'customerId'] = opts[:'customer_id'] if !opts[:'customer_id'].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] || 'GetCampaignBidding200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_campaign_bidding", :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_campaign_bidding\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_campaign_targeting(campaign_id, opts = {}) ⇒ GetCampaignTargeting200Response
Read a Google campaign's device, location, and language targeting
Google Ads compliance requires geo, language, budget, and bidding targeting set at creation to stay editable afterwards; this reads the campaign state so an integrator can build an editor around it. Cached for the quota window (10 minutes fresh, up to 7 days last-good), not always a live read. Google only; every other platform returns 501. devices lists the device criteria the campaign carries, which depends on its channel: Search campaigns have MOBILE, DESKTOP and TABLET, Display campaigns also have CONNECTED_TV. bidModifier is Google's bid adjustment for that device, null when it has none, and 0 when the device is switched off; included is false for exactly that case.
1740 1741 1742 1743 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1740 def get_campaign_targeting(campaign_id, opts = {}) data, _status_code, _headers = get_campaign_targeting_with_http_info(campaign_id, opts) data end |
#get_campaign_targeting_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetCampaignTargeting200Response, Integer, Hash)>
Read a Google campaign's device, location, and language targeting Google Ads compliance requires geo, language, budget, and bidding targeting set at creation to stay editable afterwards; this reads the campaign state so an integrator can build an editor around it. Cached for the quota window (10 minutes fresh, up to 7 days last-good), not always a live read. Google only; every other platform returns 501. `devices` lists the device criteria the campaign carries, which depends on its channel: Search campaigns have MOBILE, DESKTOP and TABLET, Display campaigns also have CONNECTED_TV. `bidModifier` is Google's bid adjustment for that device, `null` when it has none, and `0` when the device is switched off; `included` is false for exactly that case.
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 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1751 def get_campaign_targeting_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_campaign_targeting ...' 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.get_campaign_targeting" end allowable_values = ["google"] 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/{campaignId}/targeting'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} 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] || 'GetCampaignTargeting200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.get_campaign_targeting", :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_campaign_targeting\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). Google campaign budgets include amountMicros, explicitlyShared, resourceName and deliveryMethod after the next successful sync. This endpoint does not fetch Google live.
1822 1823 1824 1825 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1822 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). Google campaign budgets include amountMicros, explicitlyShared, resourceName and deliveryMethod after the next successful sync. This endpoint does not fetch Google live.
1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 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 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1845 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_group_assets(ad_set_id, account_id, opts = {}) ⇒ ListAdGroupAssets200Response
List ad-group assets Lists directly attached Google assets. Fresh reads are cached for 10 minutes; exhausted quota may return the last successful read with stale=true. Inherited assets are not included.
1935 1936 1937 1938 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1935 def list_ad_group_assets(ad_set_id, account_id, opts = {}) data, _status_code, _headers = list_ad_group_assets_with_http_info(ad_set_id, account_id, opts) data end |
#list_ad_group_assets_with_http_info(ad_set_id, account_id, opts = {}) ⇒ Array<(ListAdGroupAssets200Response, Integer, Hash)>
List ad-group assets Lists directly attached Google assets. Fresh reads are cached for 10 minutes; exhausted quota may return the last successful read with stale=true. Inherited assets are not included.
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 1948 def list_ad_group_assets_with_http_info(ad_set_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_ad_group_assets ...' 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.list_ad_group_assets" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_set_id !~ pattern fail ArgumentError, "invalid value for 'ad_set_id' when calling AdCampaignsApi.list_ad_group_assets, must conform to the pattern #{pattern}." 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.list_ad_group_assets" end pattern = Regexp.new(/^[a-fA-F0-9]{24}$/) if @api_client.config.client_side_validation && account_id !~ pattern fail ArgumentError, "invalid value for 'account_id' when calling AdCampaignsApi.list_ad_group_assets, must conform to the pattern #{pattern}." end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling AdCampaignsApi.list_ad_group_assets, must conform to the pattern #{pattern}." end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && !opts[:'customer_id'].nil? && opts[:'customer_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"customer_id\"]' when calling AdCampaignsApi.list_ad_group_assets, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}/assets'.sub('{' + 'adSetId' + '}', CGI.escape(ad_set_id.to_s)) # 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[:'customerId'] = opts[:'customer_id'] if !opts[:'customer_id'].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] || 'ListAdGroupAssets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_ad_group_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(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#list_ad_group_assets\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.
2038 2039 2040 2041 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2038 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.
2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2058 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_ad_sets(opts = {}) ⇒ ListAdSets200Response
List ad sets
Ad sets (Google ad groups) synced for the connection, optionally filtered by platform and campaignId. Reads the ad_sets table directly, independent of the ads rollup GET /v1/ads/tree uses, so a newly created standalone ad group with no ad yet (POST /v1/ads/ad-sets, Google only) is visible here even though it is invisible in the tree until an ad joins it via adSetId on POST /v1/ads/create. Returns at most 500 rows, newest first.
2144 2145 2146 2147 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2144 def list_ad_sets(opts = {}) data, _status_code, _headers = list_ad_sets_with_http_info(opts) data end |
#list_ad_sets_with_http_info(opts = {}) ⇒ Array<(ListAdSets200Response, Integer, Hash)>
List ad sets Ad sets (Google ad groups) synced for the connection, optionally filtered by platform and campaignId. Reads the `ad_sets` table directly, independent of the `ads` rollup GET /v1/ads/tree uses, so a newly created standalone ad group with no ad yet (POST /v1/ads/ad-sets, Google only) is visible here even though it is invisible in the tree until an ad joins it via `adSetId` on POST /v1/ads/create. Returns at most 500 rows, newest first.
2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2156 def list_ad_sets_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_ad_sets ...' 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/ad-sets' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].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] || 'ListAdSets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_ad_sets", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#list_ad_sets\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.
2227 2228 2229 2230 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2227 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.
2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2252 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[:'adSetId'] = opts[:'ad_set_id'] if !opts[:'ad_set_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 |
#list_bid_strategies(account_id, opts = {}) ⇒ ListBidStrategies200Response
List portfolio bid strategies
Bidding strategy report: type, status, campaign count, clicks, cost, cost per conversion, impressions, average CPC and conversions over the date range (default last 30 days). Reads Google's bidding_strategy resource, cached for the quota window. Draws on the shared Google Ads operations budget. The response carries cachedAt and stale, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
2341 2342 2343 2344 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2341 def list_bid_strategies(account_id, opts = {}) data, _status_code, _headers = list_bid_strategies_with_http_info(account_id, opts) data end |
#list_bid_strategies_with_http_info(account_id, opts = {}) ⇒ Array<(ListBidStrategies200Response, Integer, Hash)>
List portfolio bid strategies Bidding strategy report: type, status, campaign count, clicks, cost, cost per conversion, impressions, average CPC and conversions over the date range (default last 30 days). Reads Google's `bidding_strategy` resource, cached for the quota window. Draws on the shared Google Ads operations budget. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2355 def list_bid_strategies_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_bid_strategies ...' 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.list_bid_strategies" end # resource path local_var_path = '/v1/ads/bid-strategies' # 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[:'customerId'] = opts[:'customer_id'] if !opts[:'customer_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] || 'ListBidStrategies200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_bid_strategies", :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_bid_strategies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_campaign_assets(campaign_id, account_id, opts = {}) ⇒ ListCampaignAssets200Response
List campaign assets Lists directly attached Google assets. Fresh reads are cached for 10 minutes; exhausted quota may return the last successful read with stale=true. Inherited assets are not included.
2416 2417 2418 2419 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2416 def list_campaign_assets(campaign_id, account_id, opts = {}) data, _status_code, _headers = list_campaign_assets_with_http_info(campaign_id, account_id, opts) data end |
#list_campaign_assets_with_http_info(campaign_id, account_id, opts = {}) ⇒ Array<(ListCampaignAssets200Response, Integer, Hash)>
List campaign assets Lists directly attached Google assets. Fresh reads are cached for 10 minutes; exhausted quota may return the last successful read with stale=true. Inherited assets are not included.
2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2429 def list_campaign_assets_with_http_info(campaign_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_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.list_campaign_assets" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && campaign_id !~ pattern fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.list_campaign_assets, must conform to the pattern #{pattern}." 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.list_campaign_assets" end pattern = Regexp.new(/^[a-fA-F0-9]{24}$/) if @api_client.config.client_side_validation && account_id !~ pattern fail ArgumentError, "invalid value for 'account_id' when calling AdCampaignsApi.list_campaign_assets, must conform to the pattern #{pattern}." end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling AdCampaignsApi.list_campaign_assets, must conform to the pattern #{pattern}." end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && !opts[:'customer_id'].nil? && opts[:'customer_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"customer_id\"]' when calling AdCampaignsApi.list_campaign_assets, must conform to the pattern #{pattern}." 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] || {} query_params[:'accountId'] = account_id query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil? query_params[:'customerId'] = opts[:'customer_id'] if !opts[:'customer_id'].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] || 'ListCampaignAssets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_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(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#list_campaign_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_campaign_negative_keyword_lists(campaign_id, opts = {}) ⇒ ListAdNegativeKeywordLists200Response
List campaign negative lists Returns shared negative keyword lists attached to the campaign, separate from campaign-level negative keywords. Google Ads shared negative keyword lists (shared_set type NEGATIVE_KEYWORDS). Reads are cached for 10 minutes; quota exhaustion may return the last successful result for up to 7 days with stale=true. Customer selection is limited to this connection and its account scope.
2510 2511 2512 2513 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2510 def list_campaign_negative_keyword_lists(campaign_id, opts = {}) data, _status_code, _headers = list_campaign_negative_keyword_lists_with_http_info(campaign_id, opts) data end |
#list_campaign_negative_keyword_lists_with_http_info(campaign_id, opts = {}) ⇒ Array<(ListAdNegativeKeywordLists200Response, Integer, Hash)>
List campaign negative lists Returns shared negative keyword lists attached to the campaign, separate from campaign-level negative keywords. Google Ads shared negative keyword lists (shared_set type NEGATIVE_KEYWORDS). Reads are cached for 10 minutes; quota exhaustion may return the last successful result for up to 7 days with stale=true. Customer selection is limited to this connection and its account scope.
2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2521 def list_campaign_negative_keyword_lists_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_campaign_negative_keyword_lists ...' 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.list_campaign_negative_keyword_lists" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && campaign_id !~ pattern fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.list_campaign_negative_keyword_lists, must conform to the pattern #{pattern}." 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/campaigns/{campaignId}/negative-keyword-lists'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} 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] || 'ListAdNegativeKeywordLists200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_campaign_negative_keyword_lists", :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_campaign_negative_keyword_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_campaign_negative_keywords(campaign_id, opts = {}) ⇒ ListCampaignNegativeKeywords200Response
List campaign-level negative keywords
Returns the campaign-level negative keywords (campaign_criterion.negative), distinct from the ad-group-level negatives under GET /v1/ads/keywords. Cached for the quota window (not synced to Postgres), and gated by the shared Google Ads operations budget like every other on-demand Google surface. The response carries cachedAt and stale, set when a quota-exhausted call falls back to the last-good copy instead of a live read. The platform is always discovered from the campaign itself; a non-Google campaign returns 501 rather than 404, whether or not platform was passed.
2585 2586 2587 2588 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2585 def list_campaign_negative_keywords(campaign_id, opts = {}) data, _status_code, _headers = list_campaign_negative_keywords_with_http_info(campaign_id, opts) data end |
#list_campaign_negative_keywords_with_http_info(campaign_id, opts = {}) ⇒ Array<(ListCampaignNegativeKeywords200Response, Integer, Hash)>
List campaign-level negative keywords Returns the campaign-level negative keywords (`campaign_criterion.negative`), distinct from the ad-group-level negatives under `GET /v1/ads/keywords`. Cached for the quota window (not synced to Postgres), and gated by the shared Google Ads operations budget like every other on-demand Google surface. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read. The platform is always discovered from the campaign itself; a non-Google campaign returns 501 rather than 404, whether or not `platform` was passed.
2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2596 def list_campaign_negative_keywords_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_campaign_negative_keywords ...' 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.list_campaign_negative_keywords" 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/campaigns/{campaignId}/negative-keywords'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s)) # query parameters query_params = opts[:query_params] || {} 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] || 'ListCampaignNegativeKeywords200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_campaign_negative_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_campaign_negative_keywords\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_google_asset_groups(campaign_id, opts = {}) ⇒ ListGoogleAssetGroups200Response
List Performance Max asset groups Read Performance Max asset groups and their linked text, image and YouTube assets. campaignId is the platform campaign id returned by creation or the campaign list. The campaign must be visible to the caller. Uses a 10-minute cache, with the last successful response served as stale when Google quota is exhausted. Removed groups and asset links are excluded. Campaign-level brand assets on campaigns with brand guidelines enabled are not included.
2654 2655 2656 2657 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2654 def list_google_asset_groups(campaign_id, opts = {}) data, _status_code, _headers = list_google_asset_groups_with_http_info(campaign_id, opts) data end |
#list_google_asset_groups_with_http_info(campaign_id, opts = {}) ⇒ Array<(ListGoogleAssetGroups200Response, Integer, Hash)>
List Performance Max asset groups Read Performance Max asset groups and their linked text, image and YouTube assets. campaignId is the platform campaign id returned by creation or the campaign list. The campaign must be visible to the caller. Uses a 10-minute cache, with the last successful response served as stale when Google quota is exhausted. Removed groups and asset links are excluded. Campaign-level brand assets on campaigns with brand guidelines enabled are not included.
2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2664 def list_google_asset_groups_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_google_asset_groups ...' 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.list_google_asset_groups" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && campaign_id !~ pattern fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.list_google_asset_groups, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/asset-groups'.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'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListGoogleAssetGroups200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.list_google_asset_groups", :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_google_asset_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#remove_ad_group_assets(ad_set_id, remove_ad_group_assets_request, opts = {}) ⇒ RemoveCampaignAssets200Response
Remove ad-group assets Removes the specified attachments only. Google assets cannot be deleted. Other attachments remain. assetResourceNames is retained for compatibility.
2723 2724 2725 2726 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2723 def remove_ad_group_assets(ad_set_id, remove_ad_group_assets_request, opts = {}) data, _status_code, _headers = remove_ad_group_assets_with_http_info(ad_set_id, remove_ad_group_assets_request, opts) data end |
#remove_ad_group_assets_with_http_info(ad_set_id, remove_ad_group_assets_request, opts = {}) ⇒ Array<(RemoveCampaignAssets200Response, Integer, Hash)>
Remove ad-group assets Removes the specified attachments only. Google assets cannot be deleted. Other attachments remain. assetResourceNames is retained for compatibility.
2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2734 def remove_ad_group_assets_with_http_info(ad_set_id, remove_ad_group_assets_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.remove_ad_group_assets ...' 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.remove_ad_group_assets" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_set_id !~ pattern fail ArgumentError, "invalid value for 'ad_set_id' when calling AdCampaignsApi.remove_ad_group_assets, must conform to the pattern #{pattern}." end # verify the required parameter 'remove_ad_group_assets_request' is set if @api_client.config.client_side_validation && remove_ad_group_assets_request.nil? fail ArgumentError, "Missing the required parameter 'remove_ad_group_assets_request' when calling AdCampaignsApi.remove_ad_group_assets" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}/assets'.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(remove_ad_group_assets_request) # return_type return_type = opts[:debug_return_type] || 'RemoveCampaignAssets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.remove_ad_group_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(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#remove_ad_group_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#remove_ad_keyword(keyword_id, opts = {}) ⇒ RemoveAdKeyword200Response
Remove a Search keyword Removes one keyword criterion (positive or negative) from its ad group (M.140).
2801 2802 2803 2804 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2801 def remove_ad_keyword(keyword_id, opts = {}) data, _status_code, _headers = remove_ad_keyword_with_http_info(keyword_id, opts) data end |
#remove_ad_keyword_with_http_info(keyword_id, opts = {}) ⇒ Array<(RemoveAdKeyword200Response, Integer, Hash)>
Remove a Search keyword Removes one keyword criterion (positive or negative) from its ad group (M.140).
2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2811 def remove_ad_keyword_with_http_info(keyword_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.remove_ad_keyword ...' end # verify the required parameter 'keyword_id' is set if @api_client.config.client_side_validation && keyword_id.nil? fail ArgumentError, "Missing the required parameter 'keyword_id' when calling AdCampaignsApi.remove_ad_keyword" end # resource path local_var_path = '/v1/ads/keywords/{keywordId}'.sub('{' + 'keywordId' + '}', CGI.escape(keyword_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] || 'RemoveAdKeyword200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.remove_ad_keyword", :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#remove_ad_keyword\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#remove_campaign_assets(campaign_id, remove_campaign_assets_request, opts = {}) ⇒ RemoveCampaignAssets200Response
Remove campaign assets Removes the specified attachments only. Google assets cannot be deleted. Other attachments remain. assetResourceNames is retained for compatibility.
2865 2866 2867 2868 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2865 def remove_campaign_assets(campaign_id, remove_campaign_assets_request, opts = {}) data, _status_code, _headers = remove_campaign_assets_with_http_info(campaign_id, remove_campaign_assets_request, opts) data end |
#remove_campaign_assets_with_http_info(campaign_id, remove_campaign_assets_request, opts = {}) ⇒ Array<(RemoveCampaignAssets200Response, Integer, Hash)>
Remove campaign assets Removes the specified attachments only. Google assets cannot be deleted. Other attachments remain. assetResourceNames is retained for compatibility.
2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2876 def remove_campaign_assets_with_http_info(campaign_id, remove_campaign_assets_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.remove_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.remove_campaign_assets" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && campaign_id !~ pattern fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.remove_campaign_assets, must conform to the pattern #{pattern}." end # verify the required parameter 'remove_campaign_assets_request' is set if @api_client.config.client_side_validation && remove_campaign_assets_request.nil? fail ArgumentError, "Missing the required parameter 'remove_campaign_assets_request' when calling AdCampaignsApi.remove_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(remove_campaign_assets_request) # return_type return_type = opts[:debug_return_type] || 'RemoveCampaignAssets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.remove_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(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#remove_campaign_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#replace_campaign_negative_keyword_lists(campaign_id, replace_campaign_negative_keyword_lists_request, opts = {}) ⇒ ReplaceAdNegativeKeywordListKeywords200Response
Replace campaign negative lists Sets the full desired set of shared negative keyword list associations on this campaign. Send listIds=[] to detach all negative keyword lists. Only campaign_shared_set links are changed; the lists and their keywords are preserved. Every list must belong to the campaign customer and have type NEGATIVE_KEYWORDS.
2944 2945 2946 2947 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2944 def replace_campaign_negative_keyword_lists(campaign_id, replace_campaign_negative_keyword_lists_request, opts = {}) data, _status_code, _headers = replace_campaign_negative_keyword_lists_with_http_info(campaign_id, replace_campaign_negative_keyword_lists_request, opts) data end |
#replace_campaign_negative_keyword_lists_with_http_info(campaign_id, replace_campaign_negative_keyword_lists_request, opts = {}) ⇒ Array<(ReplaceAdNegativeKeywordListKeywords200Response, Integer, Hash)>
Replace campaign negative lists Sets the full desired set of shared negative keyword list associations on this campaign. Send listIds=[] to detach all negative keyword lists. Only campaign_shared_set links are changed; the lists and their keywords are preserved. Every list must belong to the campaign customer and have type NEGATIVE_KEYWORDS.
2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 2955 def replace_campaign_negative_keyword_lists_with_http_info(campaign_id, replace_campaign_negative_keyword_lists_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.replace_campaign_negative_keyword_lists ...' 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.replace_campaign_negative_keyword_lists" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && campaign_id !~ pattern fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.replace_campaign_negative_keyword_lists, must conform to the pattern #{pattern}." end # verify the required parameter 'replace_campaign_negative_keyword_lists_request' is set if @api_client.config.client_side_validation && replace_campaign_negative_keyword_lists_request.nil? fail ArgumentError, "Missing the required parameter 'replace_campaign_negative_keyword_lists_request' when calling AdCampaignsApi.replace_campaign_negative_keyword_lists" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/negative-keyword-lists'.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(replace_campaign_negative_keyword_lists_request) # return_type return_type = opts[:debug_return_type] || 'ReplaceAdNegativeKeywordListKeywords200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.replace_campaign_negative_keyword_lists", :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#replace_campaign_negative_keyword_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#replace_campaign_negative_keywords(campaign_id, replace_campaign_negative_keywords_request, opts = {}) ⇒ ReplaceCampaignNegativeKeywords200Response
Replace campaign-level negative keywords
Replaces the FULL set of campaign-level negative keywords (C.270): the desired list is diffed against what Google already has, and the difference is applied as one create/remove mutate. Send an empty array to clear every campaign negative. The platform is always discovered from the campaign itself; a non-Google campaign returns 501 rather than 404, whether or not platform was sent.
3023 3024 3025 3026 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3023 def replace_campaign_negative_keywords(campaign_id, replace_campaign_negative_keywords_request, opts = {}) data, _status_code, _headers = replace_campaign_negative_keywords_with_http_info(campaign_id, replace_campaign_negative_keywords_request, opts) data end |
#replace_campaign_negative_keywords_with_http_info(campaign_id, replace_campaign_negative_keywords_request, opts = {}) ⇒ Array<(ReplaceCampaignNegativeKeywords200Response, Integer, Hash)>
Replace campaign-level negative keywords Replaces the FULL set of campaign-level negative keywords (C.270): the desired list is diffed against what Google already has, and the difference is applied as one `create`/`remove` mutate. Send an empty array to clear every campaign negative. The platform is always discovered from the campaign itself; a non-Google campaign returns 501 rather than 404, whether or not `platform` was sent.
3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3034 def replace_campaign_negative_keywords_with_http_info(campaign_id, replace_campaign_negative_keywords_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.replace_campaign_negative_keywords ...' 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.replace_campaign_negative_keywords" end # verify the required parameter 'replace_campaign_negative_keywords_request' is set if @api_client.config.client_side_validation && replace_campaign_negative_keywords_request.nil? fail ArgumentError, "Missing the required parameter 'replace_campaign_negative_keywords_request' when calling AdCampaignsApi.replace_campaign_negative_keywords" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/negative-keywords'.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(replace_campaign_negative_keywords_request) # return_type return_type = opts[:debug_return_type] || 'ReplaceCampaignNegativeKeywords200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.replace_campaign_negative_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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#replace_campaign_negative_keywords\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, name (renames the ad), targeting (via /v2/adgroup/update/), and creative (via /v2/ad/update/ patch-style: headline is ignored, body becomes ad_text). - Google: status, budget, KEYWORD edits via targeting.keywords / targeting.negativeKeywords, DEVICE bid adjustments via targeting.devices, LOCATION edits via targeting.locations (or the equivalent top-level targeting.countries / regions / cities / zips / metros), and LANGUAGE edits via targeting.languages. Each list you send becomes the FULL new set of its kind (criteria not in the list are removed, except devices, which Google cannot remove and which are switched off with a bid modifier of 0 instead); a kind left out is untouched. Any other targeting field returns 400: Google cannot mutate it post-create without recreating the campaign. Creative edits are dispatched on the ad's advertisingChannelType, and every supported field replaces a whole set; a field you omit is preserved. - Search: top-level headlines, descriptions and finalUrls. Use 3-15 headlines (1-30 characters) and 2-4 descriptions (1-90 characters). Omit an asset to remove it; omit pinnedField on an included asset to unpin it. Updates do not pad or truncate text. The legacy creative fields remain unsupported. - Display: top-level headlines (1-5, no pinnedField, display ads have no pinned positions), descriptions (1-5) and finalUrls, plus creative.longHeadline, creative.businessName, creative.imageUrl (the landscape marketing image) and creative.squareImageUrl. Each image URL is uploaded as a new Google asset and the ad is pointed at it; Google assets are immutable, so the previous asset stays in the account's asset library. - Performance Max: top-level assetGroup, which swaps asset roles on the ad's asset group. The other creative fields return 422 for this channel, and assetGroup returns 422 on any other channel. - LinkedIn: status, budget, targeting (countries or regions, excludedLocations (countries), the B2B facets, and audience segments; applied to the LinkedIn Campaign via PARTIAL_UPDATE, and REPLACES the campaign's entire targetingCriteria, not a merge), and creative (uploads new media, creates a replacement inline creative on the same campaign, pauses the old one). - Pinterest / X / OpenAI Ads: status + budget only. Sending targeting or creative returns 501 with code unsupported_platform_operation. OpenAI Ads budget is the campaign's spend cap, daily or lifetime (see budget.type below). Google location and language replacement: locations, languages and devices are campaign-level criteria on Google, so these edits apply to every ad group and ad in the ad's campaign. Send the complete list you want to keep. Zernio diffs it against the campaign's live criteria and sends the removes and the creates in ONE googleAds:mutate, so the campaign is never left with a half-applied set; criteria already in the list keep their criterion ID and history. Excluded (negative) locations are left untouched. An empty location list returns 400 (a Google campaign with no location criteria targets every country, which is never what "remove my locations" means, so omit the field instead). Send either targeting.locations or the top-level geo fields, not both: mixing them returns 400. Google radius targeting: customLocations is editable and is replaced the same way, but as its OWN set. Google models a place (LOCATION) and a point plus radius (PROXIMITY) as different criterion types, so the two are independent: sending customLocations replaces every radius and leaves the cities and countries alone, and sending places replaces those and leaves the radius alone. Send customLocations: [] to drop radius targeting entirely. A circle you re-send unchanged keeps its criterion ID rather than being removed and recreated. Google keyword replacement: These edits affect the ad's entire ad group, including sibling ads. Positive (targeting.keywords) and negative (targeting.negativeKeywords) sets are independent: omit a field to leave that set unchanged, or send [] to remove every keyword of that kind. Zernio compares each supplied set with Google's live criteria by case-insensitive keyword text and match type. A matching criterion is left untouched, retaining its criterion ID, enabled/paused status, keyword-level bid overrides, labels, and criterion-associated history/statistics. Zernio does not reset its quality score; Google continues to calculate scores and statistics normally. Text comparison does not trim whitespace. A bare string or an object without matchType means broad, not the existing criterion's match type. For example, resending an existing { \"text\": \"plumber\", \"matchType\": \"exact\" } preserves it; sending \"plumber\" instead removes that EXACT criterion and requests a BROAD one. Changing text or match type removes criteria no longer requested and creates any missing criteria. New criteria get new IDs and do not inherit removed criteria's bid overrides, labels, or history. Historical reporting for a removed criterion is not transferred to its replacement. To add keywords without replacing a set, use POST /v1/ads/keywords. Use PATCH /v1/ads/keywords/{keywordId} to pause/enable one keyword, or DELETE /v1/ads/keywords/{keywordId} to remove it.
3097 3098 3099 3100 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3097 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, portfolioBidStrategyId, 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 | | portfolioBidStrategyId | 400 | Yes | 400 | | budget (CBO; ABO returns 409) | Yes | Daily only | OpenAI: daily or lifetime; others 501 | | name | Yes | 501 | 501 | | platformSpecificData.spendCap | Yes | 400 | 400 | | accountId (empty campaigns) | Yes | - | - | Meta budget edits check the live campaign budget, so an older local ABO stamp cannot block a CBO campaign. A successful edit repairs local ad budget fields. A live ABO campaign still returns 409 with the ad-set budget endpoint. On Google: LOWEST_COST_WITHOUT_CAP = Maximize Conversions, COST_CAP + bidAmount = Target CPA, LOWEST_COST_WITH_MIN_ROAS + roasAverageFloor = Target ROAS, LOWEST_COST_WITH_BID_CAP + bidAmount = Maximize Clicks with a CPC ceiling; portfolioBidStrategyId attaches a portfolio strategy instead (exclusive with bidStrategy). Setting the standard triplet on a campaign that is currently on a PORTFOLIO strategy is rejected: detach it in Google Ads first, since it is shared across campaigns. Google budget updates read the current budget before mutation. Shared budgets return 409 unless allowSharedBudgetUpdate=true is explicitly supplied, because the change affects every campaign using that budget. Unknown sharing state also returns 409. OpenAI Ads campaigns carry exactly one spend cap: budget.type daily or lifetime replaces whichever cap the campaign had, with a minimum of 1 in the ad account's currency (422 below it). Lifetime can switch to daily, but OpenAI never switches a daily cap back to lifetime (422). accountId forwards the update straight to Meta for a campaign with zero ads, which would otherwise 404; the response then carries updated: 0.
3171 3172 3173 3174 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3171 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. Google keeps an independent on/off switch at campaign, ad group and ad level and the most restrictive one wins, so active switches the campaign on TOGETHER with the ad groups and ads Zernio tracks under it, in one mutate. Without that the campaign reads ENABLED while a paused ad group or ad keeps it from serving. paused writes the campaign alone, which already stops delivery and leaves each ad's own switch as you set it.
3245 3246 3247 3248 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3245 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. Google keeps an independent on/off switch at campaign, ad group and ad level and the most restrictive one wins, so `active` switches the campaign on TOGETHER with the ad groups and ads Zernio tracks under it, in one mutate. Without that the campaign reads ENABLED while a paused ad group or ad keeps it from serving. `paused` writes the campaign alone, which already stops delivery and leaves each ad's own switch as you set it.
3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3256 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`, `portfolioBidStrategyId`, `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 | | `portfolioBidStrategyId` | 400 | Yes | 400 | | `budget` (CBO; ABO returns 409) | Yes | Daily only | OpenAI: daily or lifetime; others 501 | | `name` | Yes | 501 | 501 | | `platformSpecificData.spendCap` | Yes | 400 | 400 | | `accountId` (empty campaigns) | Yes | - | - | Meta budget edits check the live campaign budget, so an older local ABO stamp cannot block a CBO campaign. A successful edit repairs local ad budget fields. A live ABO campaign still returns 409 with the ad-set budget endpoint. On Google: `LOWEST_COST_WITHOUT_CAP` = Maximize Conversions, `COST_CAP` + `bidAmount` = Target CPA, `LOWEST_COST_WITH_MIN_ROAS` + `roasAverageFloor` = Target ROAS, `LOWEST_COST_WITH_BID_CAP` + `bidAmount` = Maximize Clicks with a CPC ceiling; `portfolioBidStrategyId` attaches a portfolio strategy instead (exclusive with `bidStrategy`). Setting the standard triplet on a campaign that is currently on a PORTFOLIO strategy is rejected: detach it in Google Ads first, since it is shared across campaigns. Google budget updates read the current budget before mutation. Shared budgets return 409 unless allowSharedBudgetUpdate=true is explicitly supplied, because the change affects every campaign using that budget. Unknown sharing state also returns 409. OpenAI Ads campaigns carry exactly one spend cap: `budget.type` daily or lifetime replaces whichever cap the campaign had, with a minimum of 1 in the ad account's currency (422 below it). Lifetime can switch to daily, but OpenAI never switches a daily cap back to lifetime (422). `accountId` forwards the update straight to Meta for a campaign with zero ads, which would otherwise 404; the response then carries `updated: 0`.
3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3182 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_group_assets(ad_set_id, update_campaign_assets_request, opts = {}) ⇒ UpdateCampaignAssets200Response
Update ad-group assets Edits existing Google assets in place. Send updates with assetResourceName and the fields to change. An asset is shared: changes affect every attachment using it. Omitted fields stay unchanged. The operation consumes the Google operations budget and invalidates affected cached lists.
3319 3320 3321 3322 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3319 def update_ad_group_assets(ad_set_id, update_campaign_assets_request, opts = {}) data, _status_code, _headers = update_ad_group_assets_with_http_info(ad_set_id, update_campaign_assets_request, opts) data end |
#update_ad_group_assets_with_http_info(ad_set_id, update_campaign_assets_request, opts = {}) ⇒ Array<(UpdateCampaignAssets200Response, Integer, Hash)>
Update ad-group assets Edits existing Google assets in place. Send updates with assetResourceName and the fields to change. An asset is shared: changes affect every attachment using it. Omitted fields stay unchanged. The operation consumes the Google operations budget and invalidates affected cached lists.
3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3330 def update_ad_group_assets_with_http_info(ad_set_id, update_campaign_assets_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_group_assets ...' 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_group_assets" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_set_id !~ pattern fail ArgumentError, "invalid value for 'ad_set_id' when calling AdCampaignsApi.update_ad_group_assets, must conform to the pattern #{pattern}." end # verify the required parameter 'update_campaign_assets_request' is set if @api_client.config.client_side_validation && update_campaign_assets_request.nil? fail ArgumentError, "Missing the required parameter 'update_campaign_assets_request' when calling AdCampaignsApi.update_ad_group_assets" end # resource path local_var_path = '/v1/ads/ad-sets/{adSetId}/assets'.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_campaign_assets_request) # return_type return_type = opts[:debug_return_type] || 'UpdateCampaignAssets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_group_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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_group_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_keyword(keyword_id, update_ad_keyword_request, opts = {}) ⇒ UpdateAdKeyword200Response
Pause or enable a Search keyword
Changes ad_group_criterion.status for one keyword criterion (M.140). Negative keywords have no status on Google and cannot be paused or enabled.
3398 3399 3400 3401 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3398 def update_ad_keyword(keyword_id, update_ad_keyword_request, opts = {}) data, _status_code, _headers = update_ad_keyword_with_http_info(keyword_id, update_ad_keyword_request, opts) data end |
#update_ad_keyword_with_http_info(keyword_id, update_ad_keyword_request, opts = {}) ⇒ Array<(UpdateAdKeyword200Response, Integer, Hash)>
Pause or enable a Search keyword Changes `ad_group_criterion.status` for one keyword criterion (M.140). Negative keywords have no status on Google and cannot be paused or enabled.
3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3409 def update_ad_keyword_with_http_info(keyword_id, update_ad_keyword_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_keyword ...' end # verify the required parameter 'keyword_id' is set if @api_client.config.client_side_validation && keyword_id.nil? fail ArgumentError, "Missing the required parameter 'keyword_id' when calling AdCampaignsApi.update_ad_keyword" end # verify the required parameter 'update_ad_keyword_request' is set if @api_client.config.client_side_validation && update_ad_keyword_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_keyword_request' when calling AdCampaignsApi.update_ad_keyword" end # resource path local_var_path = '/v1/ads/keywords/{keywordId}'.sub('{' + 'keywordId' + '}', CGI.escape(keyword_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_keyword_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdKeyword200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_ad_keyword", :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(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_keyword\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.
3472 3473 3474 3475 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3472 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.
3546 3547 3548 3549 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3546 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.
3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3557 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.
3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3483 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_keyword_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.
3620 3621 3622 3623 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3620 def update_ad_status(ad_id, update_ad_keyword_request, opts = {}) data, _status_code, _headers = update_ad_status_with_http_info(ad_id, update_ad_keyword_request, opts) data end |
#update_ad_status_with_http_info(ad_id, update_ad_keyword_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.
3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3631 def update_ad_status_with_http_info(ad_id, update_ad_keyword_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_keyword_request' is set if @api_client.config.client_side_validation && update_ad_keyword_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_keyword_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_keyword_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, `name` (renames the ad), targeting (via `/v2/adgroup/update/`), and creative (via `/v2/ad/update/` patch-style: `headline` is ignored, `body` becomes `ad_text`). - Google: status, budget, KEYWORD edits via `targeting.keywords` / `targeting.negativeKeywords`, DEVICE bid adjustments via `targeting.devices`, LOCATION edits via `targeting.locations` (or the equivalent top-level `targeting.countries` / `regions` / `cities` / `zips` / `metros`), and LANGUAGE edits via `targeting.languages`. Each list you send becomes the FULL new set of its kind (criteria not in the list are removed, except devices, which Google cannot remove and which are switched off with a bid modifier of 0 instead); a kind left out is untouched. Any other `targeting` field returns 400: Google cannot mutate it post-create without recreating the campaign. Creative edits are dispatched on the ad's `advertisingChannelType`, and every supported field replaces a whole set; a field you omit is preserved. - Search: top-level `headlines`, `descriptions` and `finalUrls`. Use 3-15 headlines (1-30 characters) and 2-4 descriptions (1-90 characters). Omit an asset to remove it; omit pinnedField on an included asset to unpin it. Updates do not pad or truncate text. The legacy creative fields remain unsupported. - Display: top-level `headlines` (1-5, no pinnedField, display ads have no pinned positions), `descriptions` (1-5) and `finalUrls`, plus `creative.longHeadline`, `creative.businessName`, `creative.imageUrl` (the landscape marketing image) and `creative.squareImageUrl`. Each image URL is uploaded as a new Google asset and the ad is pointed at it; Google assets are immutable, so the previous asset stays in the account's asset library. - Performance Max: top-level `assetGroup`, which swaps asset roles on the ad's asset group. The other creative fields return 422 for this channel, and `assetGroup` returns 422 on any other channel. - LinkedIn: status, budget, targeting (countries or regions, excludedLocations (countries), the B2B facets, and audience segments; applied to the LinkedIn Campaign via PARTIAL_UPDATE, and REPLACES the campaign's entire targetingCriteria, not a merge), and creative (uploads new media, creates a replacement inline creative on the same campaign, pauses the old one). - Pinterest / X / OpenAI Ads: status + budget only. Sending `targeting` or `creative` returns 501 with code `unsupported_platform_operation`. OpenAI Ads budget is the campaign's spend cap, daily or lifetime (see `budget.type` below). Google location and language replacement: locations, languages and devices are campaign-level criteria on Google, so these edits apply to every ad group and ad in the ad's campaign. Send the complete list you want to keep. Zernio diffs it against the campaign's live criteria and sends the removes and the creates in ONE `googleAds:mutate`, so the campaign is never left with a half-applied set; criteria already in the list keep their criterion ID and history. Excluded (negative) locations are left untouched. An empty location list returns 400 (a Google campaign with no location criteria targets every country, which is never what "remove my locations" means, so omit the field instead). Send either `targeting.locations` or the top-level geo fields, not both: mixing them returns 400. Google radius targeting: `customLocations` is editable and is replaced the same way, but as its OWN set. Google models a place (LOCATION) and a point plus radius (PROXIMITY) as different criterion types, so the two are independent: sending `customLocations` replaces every radius and leaves the cities and countries alone, and sending places replaces those and leaves the radius alone. Send `customLocations: []` to drop radius targeting entirely. A circle you re-send unchanged keeps its criterion ID rather than being removed and recreated. Google keyword replacement: These edits affect the ad's entire ad group, including sibling ads. Positive (`targeting.keywords`) and negative (`targeting.negativeKeywords`) sets are independent: omit a field to leave that set unchanged, or send `[]` to remove every keyword of that kind. Zernio compares each supplied set with Google's live criteria by case-insensitive keyword text and match type. A matching criterion is left untouched, retaining its criterion ID, enabled/paused status, keyword-level bid overrides, labels, and criterion-associated history/statistics. Zernio does not reset its quality score; Google continues to calculate scores and statistics normally. Text comparison does not trim whitespace. A bare string or an object without `matchType` means `broad`, not the existing criterion's match type. For example, resending an existing `{ "text": "plumber", "matchType": "exact" }` preserves it; sending `"plumber"` instead removes that EXACT criterion and requests a BROAD one. Changing text or match type removes criteria no longer requested and creates any missing criteria. New criteria get new IDs and do not inherit removed criteria's bid overrides, labels, or history. Historical reporting for a removed criterion is not transferred to its replacement. To add keywords without replacing a set, use POST /v1/ads/keywords. Use `PATCH /v1/ads/keywords/keywordId` to pause/enable one keyword, or `DELETE /v1/ads/keywords/keywordId` to remove it.
3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3108 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 |
#update_bid_strategy(strategy_id, update_bid_strategy_request, opts = {}) ⇒ UpdateBidStrategy200Response
Update portfolio bid strategy
Renames or retargets a portfolio bid strategy. The strategy's status is output only on Google's side, so it cannot be changed here; remove a strategy in Google Ads. type is only needed alongside targetCpa/targetRoas to disambiguate the field Google writes to (TARGET_CPA and MAXIMIZE_CONVERSIONS both take a target CPA; TARGET_ROAS and MAXIMIZE_CONVERSION_VALUE both take a target ROAS); the strategy's family is otherwise immutable once created.
3694 3695 3696 3697 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3694 def update_bid_strategy(strategy_id, update_bid_strategy_request, opts = {}) data, _status_code, _headers = update_bid_strategy_with_http_info(strategy_id, update_bid_strategy_request, opts) data end |
#update_bid_strategy_with_http_info(strategy_id, update_bid_strategy_request, opts = {}) ⇒ Array<(UpdateBidStrategy200Response, Integer, Hash)>
Update portfolio bid strategy Renames or retargets a portfolio bid strategy. The strategy's status is output only on Google's side, so it cannot be changed here; remove a strategy in Google Ads. `type` is only needed alongside `targetCpa`/`targetRoas` to disambiguate the field Google writes to (TARGET_CPA and MAXIMIZE_CONVERSIONS both take a target CPA; TARGET_ROAS and MAXIMIZE_CONVERSION_VALUE both take a target ROAS); the strategy's family is otherwise immutable once created.
3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3705 def update_bid_strategy_with_http_info(strategy_id, update_bid_strategy_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_bid_strategy ...' end # verify the required parameter 'strategy_id' is set if @api_client.config.client_side_validation && strategy_id.nil? fail ArgumentError, "Missing the required parameter 'strategy_id' when calling AdCampaignsApi.update_bid_strategy" end # verify the required parameter 'update_bid_strategy_request' is set if @api_client.config.client_side_validation && update_bid_strategy_request.nil? fail ArgumentError, "Missing the required parameter 'update_bid_strategy_request' when calling AdCampaignsApi.update_bid_strategy" end # resource path local_var_path = '/v1/ads/bid-strategies/{strategyId}'.sub('{' + 'strategyId' + '}', CGI.escape(strategy_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_bid_strategy_request) # return_type return_type = opts[:debug_return_type] || 'UpdateBidStrategy200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_bid_strategy", :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(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_bid_strategy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_campaign_ad_schedule(campaign_id, update_campaign_ad_schedule_request, opts = {}) ⇒ UpdateCampaignAdSchedule200Response
Replace a campaign's ad schedule (dayparting)
Replaces the campaign's whole ad schedule with the windows you send. This is a REPLACE, not a merge: windows you leave out stop serving. Send schedule: [] to clear dayparting, which returns the campaign to serving around the clock. Google rules enforced here, so you get a named field instead of a criterion error: at most 6 windows per day, a window must end after it starts, windows on the same day may not overlap, endHour 24 is midnight and cannot carry minutes, and minutes are quarter-hours only (0, 15, 30, 45). bidModifier is 0.1-10.0; Google's 0 means "off" for devices only, so a window is switched off by leaving it out. Windows are half-open (Google is exclusive of the end minute), so 09:00-12:00 and 12:00-17:00 on the same day are adjacent and both valid. Google cannot edit an ad schedule in place (every AdScheduleInfo field is prohibited on update), so this removes the live criteria and creates the new ones in a single atomic mutate. The response is read back from Google and carries the new criterion ids.
3768 3769 3770 3771 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3768 def update_campaign_ad_schedule(campaign_id, update_campaign_ad_schedule_request, opts = {}) data, _status_code, _headers = update_campaign_ad_schedule_with_http_info(campaign_id, update_campaign_ad_schedule_request, opts) data end |
#update_campaign_ad_schedule_with_http_info(campaign_id, update_campaign_ad_schedule_request, opts = {}) ⇒ Array<(UpdateCampaignAdSchedule200Response, Integer, Hash)>
Replace a campaign's ad schedule (dayparting) Replaces the campaign's whole ad schedule with the windows you send. This is a REPLACE, not a merge: windows you leave out stop serving. Send `schedule: []` to clear dayparting, which returns the campaign to serving around the clock. Google rules enforced here, so you get a named field instead of a criterion error: at most 6 windows per day, a window must end after it starts, windows on the same day may not overlap, `endHour` 24 is midnight and cannot carry minutes, and minutes are quarter-hours only (0, 15, 30, 45). `bidModifier` is 0.1-10.0; Google's 0 means "off" for devices only, so a window is switched off by leaving it out. Windows are half-open (Google is exclusive of the end minute), so 09:00-12:00 and 12:00-17:00 on the same day are adjacent and both valid. Google cannot edit an ad schedule in place (every AdScheduleInfo field is prohibited on update), so this removes the live criteria and creates the new ones in a single atomic mutate. The response is read back from Google and carries the new criterion ids.
3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3779 def update_campaign_ad_schedule_with_http_info(campaign_id, update_campaign_ad_schedule_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_campaign_ad_schedule ...' 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_campaign_ad_schedule" end # verify the required parameter 'update_campaign_ad_schedule_request' is set if @api_client.config.client_side_validation && update_campaign_ad_schedule_request.nil? fail ArgumentError, "Missing the required parameter 'update_campaign_ad_schedule_request' when calling AdCampaignsApi.update_campaign_ad_schedule" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/ad-schedule'.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_campaign_ad_schedule_request) # return_type return_type = opts[:debug_return_type] || 'UpdateCampaignAdSchedule200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_campaign_ad_schedule", :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_campaign_ad_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_campaign_assets(campaign_id, update_campaign_assets_request, opts = {}) ⇒ UpdateCampaignAssets200Response
Update campaign assets Edits existing Google assets in place. Send updates with assetResourceName and the fields to change. An asset is shared: changes affect every attachment using it. Omitted fields stay unchanged. The operation consumes the Google operations budget and invalidates affected cached lists.
3842 3843 3844 3845 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3842 def update_campaign_assets(campaign_id, update_campaign_assets_request, opts = {}) data, _status_code, _headers = update_campaign_assets_with_http_info(campaign_id, update_campaign_assets_request, opts) data end |
#update_campaign_assets_with_http_info(campaign_id, update_campaign_assets_request, opts = {}) ⇒ Array<(UpdateCampaignAssets200Response, Integer, Hash)>
Update campaign assets Edits existing Google assets in place. Send updates with assetResourceName and the fields to change. An asset is shared: changes affect every attachment using it. Omitted fields stay unchanged. The operation consumes the Google operations budget and invalidates affected cached lists.
3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3853 def update_campaign_assets_with_http_info(campaign_id, update_campaign_assets_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_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.update_campaign_assets" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && campaign_id !~ pattern fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.update_campaign_assets, must conform to the pattern #{pattern}." end # verify the required parameter 'update_campaign_assets_request' is set if @api_client.config.client_side_validation && update_campaign_assets_request.nil? fail ArgumentError, "Missing the required parameter 'update_campaign_assets_request' when calling AdCampaignsApi.update_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(update_campaign_assets_request) # return_type return_type = opts[:debug_return_type] || 'UpdateCampaignAssets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdCampaignsApi#update_campaign_assets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_campaign_targeting(campaign_id, update_campaign_targeting_request, opts = {}) ⇒ UpdateCampaignTargeting200Response
Edit a Google campaign's device, location, or language targeting
Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards. Send at least one of devices, locations, languages, locationTargetingType; each provided field REPLACES that field's existing criteria on the campaign (a full set, not a delta). Fields left out of the body are untouched. Google only; every other platform returns 501. devices is the full set of device bid modifiers: a supported device you leave out is switched off with a bid modifier of 0, since Google cannot remove a device criterion. A device the campaign's channel does not carry, and a set that switches every device off, both return 422. locations accepts the same shapes as campaign creation: a bare array of ISO country codes, or an object with countries/regions/cities/zips/metros key lists (key from GET /v1/ads/targeting/search?dimension=geo). Negative (excluded) locations are left untouched by this endpoint. An empty location list returns 400 instead of removing every criterion: a Google campaign with no location criteria targets every country, so omit locations to leave targeting alone. The removes and the creates go out in ONE Google googleAds:mutate, so a failed edit leaves the campaign's previous set intact rather than a half-applied one. languages is an array of Google's language codes (ISO 639-1, plus variants such as zh_CN); an unknown code returns 400. locationTargetingType switches who the location targeting reaches: presence (people in or regularly in the locations) or presence_or_interest (also people searching for or interested in them). Example: { \"platform\": \"google\", \"targeting\": { \"locationTargetingType\": \"presence\" } }. The response includes the refreshed devices/locations/languages state read back from Google after the edit, and invalidates the cached copy GET on this campaign would otherwise keep serving.
3921 3922 3923 3924 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3921 def update_campaign_targeting(campaign_id, update_campaign_targeting_request, opts = {}) data, _status_code, _headers = update_campaign_targeting_with_http_info(campaign_id, update_campaign_targeting_request, opts) data end |
#update_campaign_targeting_with_http_info(campaign_id, update_campaign_targeting_request, opts = {}) ⇒ Array<(UpdateCampaignTargeting200Response, Integer, Hash)>
Edit a Google campaign's device, location, or language targeting Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards. Send at least one of `devices`, `locations`, `languages`, `locationTargetingType`; each provided field REPLACES that field's existing criteria on the campaign (a full set, not a delta). Fields left out of the body are untouched. Google only; every other platform returns 501. `devices` is the full set of device bid modifiers: a supported device you leave out is switched off with a bid modifier of 0, since Google cannot remove a device criterion. A device the campaign's channel does not carry, and a set that switches every device off, both return 422. `locations` accepts the same shapes as campaign creation: a bare array of ISO country codes, or an object with `countries`/`regions`/`cities`/`zips`/`metros` key lists (`key` from GET /v1/ads/targeting/search?dimension=geo). Negative (excluded) locations are left untouched by this endpoint. An empty location list returns 400 instead of removing every criterion: a Google campaign with no location criteria targets every country, so omit `locations` to leave targeting alone. The removes and the creates go out in ONE Google `googleAds:mutate`, so a failed edit leaves the campaign's previous set intact rather than a half-applied one. `languages` is an array of Google's language codes (ISO 639-1, plus variants such as `zh_CN`); an unknown code returns 400. `locationTargetingType` switches who the location targeting reaches: `presence` (people in or regularly in the locations) or `presence_or_interest` (also people searching for or interested in them). Example: `{ "platform": "google", "targeting": { "locationTargetingType": "presence" } }`. The response includes the refreshed `devices`/`locations`/`languages` state read back from Google after the edit, and invalidates the cached copy `GET` on this campaign would otherwise keep serving.
3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 |
# File 'lib/zernio-sdk/api/ad_campaigns_api.rb', line 3932 def update_campaign_targeting_with_http_info(campaign_id, update_campaign_targeting_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_campaign_targeting ...' 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_campaign_targeting" end # verify the required parameter 'update_campaign_targeting_request' is set if @api_client.config.client_side_validation && update_campaign_targeting_request.nil? fail ArgumentError, "Missing the required parameter 'update_campaign_targeting_request' when calling AdCampaignsApi.update_campaign_targeting" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/targeting'.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_campaign_targeting_request) # return_type return_type = opts[:debug_return_type] || 'UpdateCampaignTargeting200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdCampaignsApi.update_campaign_targeting", :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_campaign_targeting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |