Class: Zernio::AdsApi
- Inherits:
-
Object
- Object
- Zernio::AdsApi
- Defined in:
- lib/zernio-sdk/api/ads_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#add_conversion_associations(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ AddConversionAssociations200Response
Associate campaigns Associate one or more campaigns with this conversion rule.
-
#add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ Array<(AddConversionAssociations200Response, Integer, Hash)>
Associate campaigns Associate one or more campaigns with this conversion rule.
-
#adjust_conversions(adjust_conversions_request, opts = {}) ⇒ AdjustConversions200Response
Adjust uploaded conversions Adjust conversions that were previously uploaded via
POST /v1/ads/conversions— retract them, restate their value, or enhance them with first-party data. -
#adjust_conversions_with_http_info(adjust_conversions_request, opts = {}) ⇒ Array<(AdjustConversions200Response, Integer, Hash)>
Adjust uploaded conversions Adjust conversions that were previously uploaded via `POST /v1/ads/conversions` — retract them, restate their value, or enhance them with first-party data.
-
#archive_lead_form(form_id, account_id, opts = {}) ⇒ ArchiveLeadForm200Response
Archive a lead form Meta has no hard delete for forms; this archives the form (status=ARCHIVED).
-
#archive_lead_form_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(ArchiveLeadForm200Response, Integer, Hash)>
Archive a lead form Meta has no hard delete for forms; this archives the form (status=ARCHIVED).
-
#boost_post(boost_post_request, opts = {}) ⇒ UpdateAd200Response
Boost post as ad Creates a paid ad campaign from an existing published post.
-
#boost_post_with_http_info(boost_post_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>
Boost post as ad Creates a paid ad campaign from an existing published post.
-
#create_ad_insights_report(create_ad_insights_report_request, opts = {}) ⇒ CreateAdInsightsReport202Response
Submit an async insights report run (Meta) Submits an asynchronous Meta insights report.
-
#create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts = {}) ⇒ Array<(CreateAdInsightsReport202Response, Integer, Hash)>
Submit an async insights report run (Meta) Submits an asynchronous Meta insights report.
-
#create_conversion_destination(account_id, create_conversion_destination_request, opts = {}) ⇒ CreateConversionDestination201Response
Create a conversion destination Create a new conversion destination on the platform.
-
#create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts = {}) ⇒ Array<(CreateConversionDestination201Response, Integer, Hash)>
Create a conversion destination Create a new conversion destination on the platform.
-
#create_ctwa_ad(create_ctwa_ad_request, opts = {}) ⇒ CreateCtwaAd201Response
Create Click-to-WhatsApp ad Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set.
-
#create_ctwa_ad_with_http_info(create_ctwa_ad_request, opts = {}) ⇒ Array<(CreateCtwaAd201Response, Integer, Hash)>
Create Click-to-WhatsApp ad Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set.
-
#create_lead_form(create_lead_form_request, opts = {}) ⇒ CreateLeadForm200Response
Create a lead form Creates a Lead Gen form on the connected Facebook Page (POST /page-id/leadgen_forms).
-
#create_lead_form_with_http_info(create_lead_form_request, opts = {}) ⇒ Array<(CreateLeadForm200Response, Integer, Hash)>
Create a lead form Creates a Lead Gen form on the connected Facebook Page (POST /page-id/leadgen_forms).
-
#create_standalone_ad(create_standalone_ad_request, opts = {}) ⇒ CreateStandaloneAd201Response
Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, and LinkedIn.
-
#create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) ⇒ Array<(CreateStandaloneAd201Response, Integer, Hash)>
Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, and LinkedIn.
-
#create_test_lead(form_id, create_test_lead_request, opts = {}) ⇒ CreateTestLead200Response
Create a test lead Submits a test lead against the form (POST /form-id/test_leads) to exercise retrieval without waiting for real ad impressions.
-
#create_test_lead_with_http_info(form_id, create_test_lead_request, opts = {}) ⇒ Array<(CreateTestLead200Response, Integer, Hash)>
Create a test lead Submits a test lead against the form (POST /form-id/test_leads) to exercise retrieval without waiting for real ad impressions.
-
#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_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.
-
#delete_conversion_destination(account_id, destination_id, opts = {}) ⇒ nil
Delete a conversion destination LinkedIn-only today.
-
#delete_conversion_destination_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete a conversion destination LinkedIn-only today.
-
#estimate_ad_reach(estimate_ad_reach_request, opts = {}) ⇒ EstimateAdReach200Response
Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created.
-
#estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {}) ⇒ Array<(EstimateAdReach200Response, Integer, Hash)>
Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created.
-
#get_ad(ad_id, opts = {}) ⇒ GetAd200Response
Get ad details Returns an ad with its creative, targeting, status, and performance metrics.
-
#get_ad_analytics(ad_id, opts = {}) ⇒ GetAdAnalytics200Response
Get ad analytics Returns detailed performance analytics for an ad.
-
#get_ad_analytics_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdAnalytics200Response, Integer, Hash)>
Get ad analytics Returns detailed performance analytics for an ad.
-
#get_ad_comments(ad_id, opts = {}) ⇒ GetAdComments200Response
List comments on an ad Returns comments on an ad's underlying creative post.
-
#get_ad_comments_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdComments200Response, Integer, Hash)>
List comments on an ad Returns comments on an ad's underlying creative post.
-
#get_ad_insights_report(report_run_id, account_id, opts = {}) ⇒ GetAdInsightsReport200Response
Poll an async insights report run (Meta) Status and results for a report run created via POST /v1/ads/insights/reports.
-
#get_ad_insights_report_with_http_info(report_run_id, account_id, opts = {}) ⇒ Array<(GetAdInsightsReport200Response, Integer, Hash)>
Poll an async insights report run (Meta) Status and results for a report run created via POST /v1/ads/insights/reports.
-
#get_ad_tracking_tags(ad_id, opts = {}) ⇒ GetAdTrackingTags200Response
Get ad tracking tags Unified read of the platform's native click-URL tracking params.
-
#get_ad_tracking_tags_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdTrackingTags200Response, Integer, Hash)>
Get ad tracking tags Unified read of the platform's native click-URL tracking params.
-
#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_campaign_analytics(campaign_id, opts = {}) ⇒ GetCampaignAnalytics200Response
Get campaign analytics Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns.
-
#get_campaign_analytics_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetCampaignAnalytics200Response, Integer, Hash)>
Get campaign analytics Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns.
-
#get_conversion_destination(account_id, destination_id, ad_account_id, opts = {}) ⇒ GetConversionDestination200Response
Get a conversion destination LinkedIn-only today.
-
#get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>
Get a conversion destination LinkedIn-only today.
-
#get_conversion_metrics(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ GetConversionMetrics200Response
Get attribution metrics LinkedIn-only today.
-
#get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ Array<(GetConversionMetrics200Response, Integer, Hash)>
Get attribution metrics LinkedIn-only today.
-
#get_conversions_quality(account_id, destination_id, opts = {}) ⇒ GetConversionsQuality200Response
Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API.
-
#get_conversions_quality_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(GetConversionsQuality200Response, Integer, Hash)>
Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API.
-
#get_dsa_defaults(account_id, ad_account_id, opts = {}) ⇒ UpdateAdAccount200Response
Get ad account DSA defaults Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via
PATCH /v1/ads/accountsor in Meta Ads Manager. -
#get_dsa_defaults_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(UpdateAdAccount200Response, Integer, Hash)>
Get ad account DSA defaults Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via `PATCH /v1/ads/accounts` or in Meta Ads Manager.
-
#get_dsa_recommendations(account_id, ad_account_id, opts = {}) ⇒ GetDsaRecommendations200Response
List DSA beneficiary/payor suggestions Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity.
-
#get_dsa_recommendations_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(GetDsaRecommendations200Response, Integer, Hash)>
List DSA beneficiary/payor suggestions Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity.
-
#get_lead_form(form_id, account_id, opts = {}) ⇒ GetLeadForm200Response
Get a lead form.
-
#get_lead_form_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(GetLeadForm200Response, Integer, Hash)>
Get a lead form.
-
#get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {}) ⇒ GetLinkedInBidPricing200Response
Suggested bid and budget bounds (LinkedIn) LinkedIn-only.
-
#get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {}) ⇒ Array<(GetLinkedInBidPricing200Response, Integer, Hash)>
Suggested bid and budget bounds (LinkedIn) LinkedIn-only.
-
#get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {}) ⇒ GetLinkedInSupplyForecast200Response
Impressions, clicks and spend forecast (LinkedIn) LinkedIn-only.
-
#get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {}) ⇒ Array<(GetLinkedInSupplyForecast200Response, Integer, Hash)>
Impressions, clicks and spend forecast (LinkedIn) LinkedIn-only.
-
#initialize(api_client = ApiClient.default) ⇒ AdsApi
constructor
A new instance of AdsApi.
-
#list_ad_accounts(account_id, opts = {}) ⇒ ListAdAccounts200Response
List ad accounts Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs).
-
#list_ad_accounts_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdAccounts200Response, Integer, Hash)>
List ad accounts Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs).
-
#list_ad_catalog_product_sets(catalog_id, account_id, opts = {}) ⇒ ListAdCatalogProductSets200Response
List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes.
-
#list_ad_catalog_product_sets_with_http_info(catalog_id, account_id, opts = {}) ⇒ Array<(ListAdCatalogProductSets200Response, Integer, Hash)>
List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes.
-
#list_ad_catalogs(account_id, ad_account_id, opts = {}) ⇒ ListAdCatalogs200Response
List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (
goal: catalog_saleson POST /v1/ads/create — e.g. vehicle inventory catalogs). -
#list_ad_catalogs_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdCatalogs200Response, Integer, Hash)>
List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (`goal: catalog_sales` on POST /v1/ads/create — e.g. vehicle inventory catalogs).
-
#list_ads(opts = {}) ⇒ ListAds200Response
List ads Returns a paginated list of ads with metrics computed over an optional date range.
-
#list_ads_business_centers(account_id, opts = {}) ⇒ ListAdsBusinessCenters200Response
List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected
tiktokadsaccount can read. -
#list_ads_business_centers_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdsBusinessCenters200Response, Integer, Hash)>
List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected `tiktokads` account can read.
-
#list_ads_with_http_info(opts = {}) ⇒ Array<(ListAds200Response, Integer, Hash)>
List ads Returns a paginated list of ads with metrics computed over an optional date range.
-
#list_conversion_associations(account_id, destination_id, ad_account_id, opts = {}) ⇒ ListConversionAssociations200Response
List associated campaigns LinkedIn-only today.
-
#list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(ListConversionAssociations200Response, Integer, Hash)>
List associated campaigns LinkedIn-only today.
-
#list_conversion_destinations(account_id, opts = {}) ⇒ ListConversionDestinations200Response
List conversion destinations Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account.
-
#list_conversion_destinations_with_http_info(account_id, opts = {}) ⇒ Array<(ListConversionDestinations200Response, Integer, Hash)>
List conversion destinations Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account.
-
#list_form_leads(form_id, account_id, opts = {}) ⇒ ListFormLeads200Response
List leads for a single form Returns leads for one form.
-
#list_form_leads_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(ListFormLeads200Response, Integer, Hash)>
List leads for a single form Returns leads for one form.
-
#list_lead_forms(account_id, opts = {}) ⇒ ListLeadForms200Response
List lead forms Lists the Lead Gen forms owned by the connected Facebook Page.
-
#list_lead_forms_with_http_info(account_id, opts = {}) ⇒ Array<(ListLeadForms200Response, Integer, Hash)>
List lead forms Lists the Lead Gen forms owned by the connected Facebook Page.
-
#list_leads(opts = {}) ⇒ ListLeads200Response
List submitted leads Returns persisted Meta Lead Gen leads for your team, newest-first, with keyset pagination on
cursor. -
#list_leads_with_http_info(opts = {}) ⇒ Array<(ListLeads200Response, Integer, Hash)>
List submitted leads Returns persisted Meta Lead Gen leads for your team, newest-first, with keyset pagination on `cursor`.
-
#list_whats_app_conversions(account_id, opts = {}) ⇒ ListWhatsAppConversions200Response
List conversion events Returns the most recent conversion events sent through
POST /v1/whatsapp/conversionsfor the given WhatsApp account. -
#list_whats_app_conversions_with_http_info(account_id, opts = {}) ⇒ Array<(ListWhatsAppConversions200Response, Integer, Hash)>
List conversion events Returns the most recent conversion events sent through `POST /v1/whatsapp/conversions` for the given WhatsApp account.
-
#query_ad_insights(account_id, object_id, opts = {}) ⇒ QueryAdInsights200Response
Flexible live insights query (Meta) Live, flexible insights query against Meta's Graph API.
-
#query_ad_insights_with_http_info(account_id, object_id, opts = {}) ⇒ Array<(QueryAdInsights200Response, Integer, Hash)>
Flexible live insights query (Meta) Live, flexible insights query against Meta's Graph API.
-
#remove_conversion_associations(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ RemoveConversionAssociations200Response
Remove associated campaigns Remove one or more campaign associations from this conversion rule.
-
#remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ Array<(RemoveConversionAssociations200Response, Integer, Hash)>
Remove associated campaigns Remove one or more campaign associations from this conversion rule.
-
#search_ad_interests(q, account_id, opts = {}) ⇒ SearchAdInterests200Response
Search targeting interests Deprecated alias for
GET /v1/ads/targeting/search?dimension=interest. -
#search_ad_interests_with_http_info(q, account_id, opts = {}) ⇒ Array<(SearchAdInterests200Response, Integer, Hash)>
Search targeting interests Deprecated alias for `GET /v1/ads/targeting/search?dimension=interest`.
-
#search_ad_targeting(account_id, q, opts = {}) ⇒ SearchAdTargeting200Response
Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the
TargetingSpec(countries/regions/cities/zips/metrosgeo keys, andinterests/behaviorsentity ids) onPOST /v1/ads/create,POST /v1/ads/targeting/reach-estimate, andsaved_targetingaudiences. -
#search_ad_targeting_with_http_info(account_id, q, opts = {}) ⇒ Array<(SearchAdTargeting200Response, Integer, Hash)>
Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the `TargetingSpec` (`countries`/`regions`/`cities`/`zips`/`metros` geo keys, and `interests`/`behaviors` entity ids) on `POST /v1/ads/create`, `POST /v1/ads/targeting/reach-estimate`, and `saved_targeting` audiences.
-
#send_conversions(send_conversions_request, opts = {}) ⇒ SendConversions200Response
Send conversion events Relay one or more conversion events to the target ad platform's native Conversions API.
-
#send_conversions_with_http_info(send_conversions_request, opts = {}) ⇒ Array<(SendConversions200Response, Integer, Hash)>
Send conversion events Relay one or more conversion events to the target ad platform's native Conversions API.
-
#send_whats_app_conversion(send_whats_app_conversion_request, opts = {}) ⇒ SendWhatsAppConversion200Response
Send WhatsApp conversion event Forward a WhatsApp Business Messaging conversion event (
LeadSubmitted,Purchase,AddToCart,InitiateCheckout,ViewContent) to Meta's Conversions API withaction_source = business_messagingandmessaging_channel = whatsapp. -
#send_whats_app_conversion_with_http_info(send_whats_app_conversion_request, opts = {}) ⇒ Array<(SendWhatsAppConversion200Response, Integer, Hash)>
Send WhatsApp conversion event Forward a WhatsApp Business Messaging conversion event (`LeadSubmitted`, `Purchase`, `AddToCart`, `InitiateCheckout`, `ViewContent`) to Meta's Conversions API with `action_source = business_messaging` and `messaging_channel = whatsapp`.
-
#update_ad(ad_id, update_ad_request, opts = {}) ⇒ UpdateAd200Response
Update ad Patch one or more fields on an ad.
-
#update_ad_account(update_ad_account_request, opts = {}) ⇒ UpdateAdAccount200Response
Update ad account settings Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26).
-
#update_ad_account_with_http_info(update_ad_account_request, opts = {}) ⇒ Array<(UpdateAdAccount200Response, Integer, Hash)>
Update ad account settings Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26).
-
#update_ad_status(ad_id, update_ad_status_request, opts = {}) ⇒ UpdateAdStatus200Response
Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running).
-
#update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {}) ⇒ Array<(UpdateAdStatus200Response, Integer, Hash)>
Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running).
-
#update_ad_tracking_tags(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ nil
Set ad tracking tags Unified update.
-
#update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Set ad tracking tags Unified update.
-
#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_conversion_destination(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ GetConversionDestination200Response
Update a conversion destination Partial-update a conversion rule.
-
#update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>
Update a conversion destination Partial-update a conversion rule.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#add_conversion_associations(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ AddConversionAssociations200Response
Associate campaigns Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).
29 30 31 32 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 29 def add_conversion_associations(account_id, destination_id, add_conversion_associations_request, opts = {}) data, _status_code, _headers = add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts) data end |
#add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts = {}) ⇒ Array<(AddConversionAssociations200Response, Integer, Hash)>
Associate campaigns Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 41 def add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.add_conversion_associations ...' 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 AdsApi.add_conversion_associations" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.add_conversion_associations" end # verify the required parameter 'add_conversion_associations_request' is set if @api_client.config.client_side_validation && add_conversion_associations_request.nil? fail ArgumentError, "Missing the required parameter 'add_conversion_associations_request' when calling AdsApi.add_conversion_associations" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_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(add_conversion_associations_request) # return_type return_type = opts[:debug_return_type] || 'AddConversionAssociations200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.add_conversion_associations", :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: AdsApi#add_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#adjust_conversions(adjust_conversions_request, opts = {}) ⇒ AdjustConversions200Response
Adjust uploaded conversions
Adjust conversions that were previously uploaded via POST /v1/ads/conversions — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. Google Ads only. Google handles adjustments through the classic Google Ads API (ConversionAdjustmentUploadService); the Data Manager ingestEvents path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns 405 for those platforms. Adjustment types: - RETRACTION — remove the conversion entirely (refund, chargeback, cancelled order, churn). - RESTATEMENT — change the conversion's value (upgrade / downgrade / partial refund). Send the corrected total value in restatementValue (not a delta). - ENHANCEMENT — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - orderId — the transaction ID you sent as eventId on the original conversion. Recommended, and required for ENHANCEMENT. - or gclid + conversionTime — the click ID and the original conversion's time (unix seconds). Not available for ENHANCEMENT. destinationId is the conversion action resource name, e.g. customers/1234567890/conversionActions/987654321 (same value you send to POST /v1/ads/conversions). PII in user is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google's required yyyy-MM-dd HH:mm:ss+00:00 format. Up to 2000 adjustments per request; partial failure is supported (inspect adjustmentsFailed / failures[]).
107 108 109 110 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 107 def adjust_conversions(adjust_conversions_request, opts = {}) data, _status_code, _headers = adjust_conversions_with_http_info(adjust_conversions_request, opts) data end |
#adjust_conversions_with_http_info(adjust_conversions_request, opts = {}) ⇒ Array<(AdjustConversions200Response, Integer, Hash)>
Adjust uploaded conversions Adjust conversions that were previously uploaded via `POST /v1/ads/conversions` — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. Google Ads only. Google handles adjustments through the classic Google Ads API (`ConversionAdjustmentUploadService`); the Data Manager `ingestEvents` path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns `405` for those platforms. Adjustment types: - `RETRACTION` — remove the conversion entirely (refund, chargeback, cancelled order, churn). - `RESTATEMENT` — change the conversion's value (upgrade / downgrade / partial refund). Send the corrected total value in `restatementValue` (not a delta). - `ENHANCEMENT` — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - `orderId` — the transaction ID you sent as `eventId` on the original conversion. Recommended, and required for `ENHANCEMENT`. - or `gclid` + `conversionTime` — the click ID and the original conversion's time (unix seconds). Not available for `ENHANCEMENT`. `destinationId` is the conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` (same value you send to `POST /v1/ads/conversions`). PII in `user` is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google's required `yyyy-MM-dd HH:mm:ss+00:00` format. Up to 2000 adjustments per request; partial failure is supported (inspect `adjustmentsFailed` / `failures`).
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 117 def adjust_conversions_with_http_info(adjust_conversions_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.adjust_conversions ...' end # verify the required parameter 'adjust_conversions_request' is set if @api_client.config.client_side_validation && adjust_conversions_request.nil? fail ArgumentError, "Missing the required parameter 'adjust_conversions_request' when calling AdsApi.adjust_conversions" end # resource path local_var_path = '/v1/ads/conversions/adjustments' # 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(adjust_conversions_request) # return_type return_type = opts[:debug_return_type] || 'AdjustConversions200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.adjust_conversions", :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: AdsApi#adjust_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#archive_lead_form(form_id, account_id, opts = {}) ⇒ ArchiveLeadForm200Response
Archive a lead form Meta has no hard delete for forms; this archives the form (status=ARCHIVED).
176 177 178 179 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 176 def archive_lead_form(form_id, account_id, opts = {}) data, _status_code, _headers = archive_lead_form_with_http_info(form_id, account_id, opts) data end |
#archive_lead_form_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(ArchiveLeadForm200Response, Integer, Hash)>
Archive a lead form Meta has no hard delete for forms; this archives the form (status=ARCHIVED).
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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 187 def archive_lead_form_with_http_info(form_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.archive_lead_form ...' end # verify the required parameter 'form_id' is set if @api_client.config.client_side_validation && form_id.nil? fail ArgumentError, "Missing the required parameter 'form_id' when calling AdsApi.archive_lead_form" 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 AdsApi.archive_lead_form" end # resource path local_var_path = '/v1/ads/lead-forms/{formId}'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id # 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] || 'ArchiveLeadForm200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.archive_lead_form", :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: AdsApi#archive_lead_form\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 campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).
245 246 247 248 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 245 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 campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 255 def boost_post_with_http_info(boost_post_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.boost_post" 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 # 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 => :"AdsApi.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: AdsApi#boost_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_ad_insights_report(create_ad_insights_report_request, opts = {}) ⇒ CreateAdInsightsReport202Response
Submit an async insights report run (Meta)
Submits an asynchronous Meta insights report. Same query surface as GET /v1/ads/insights, but in the JSON body; Meta processes the report server-side, which is the right choice for long ranges or large accounts where the sync query is slow or rate-limited. Returns a reportRunId to poll via GET /v1/ads/insights/reports/reportRunId. Meta only.
313 314 315 316 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 313 def create_ad_insights_report(create_ad_insights_report_request, opts = {}) data, _status_code, _headers = create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts) data end |
#create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts = {}) ⇒ Array<(CreateAdInsightsReport202Response, Integer, Hash)>
Submit an async insights report run (Meta) Submits an asynchronous Meta insights report. Same query surface as GET /v1/ads/insights, but in the JSON body; Meta processes the report server-side, which is the right choice for long ranges or large accounts where the sync query is slow or rate-limited. Returns a `reportRunId` to poll via GET /v1/ads/insights/reports/reportRunId. Meta only.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 323 def create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.create_ad_insights_report ...' end # verify the required parameter 'create_ad_insights_report_request' is set if @api_client.config.client_side_validation && create_ad_insights_report_request.nil? fail ArgumentError, "Missing the required parameter 'create_ad_insights_report_request' when calling AdsApi.create_ad_insights_report" end # resource path local_var_path = '/v1/ads/insights/reports' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_ad_insights_report_request) # return_type return_type = opts[:debug_return_type] || 'CreateAdInsightsReport202Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.create_ad_insights_report", :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: AdsApi#create_ad_insights_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_conversion_destination(account_id, create_conversion_destination_request, opts = {}) ⇒ CreateConversionDestination201Response
Create a conversion destination
Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta manages destinations in its own UI and returns 405. LinkedIn: creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. Google Ads: calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed IDEMPOTENCY_CONFLICT (409) rather than silently returning the mismatched action. LinkedIn: the rule is created with conversionMethod=CONVERSIONS_API and (by default) auto-associated with all of the ad account's campaigns via autoAssociationType=ALL_CAMPAIGNS. Pass autoAssociationType: NONE to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for SUBMIT_APPLICATION, PURCHASE, ADD_TO_CART, QUALIFIED_LEAD, and LEAD rule types; the API rejects other combinations locally. Google Ads: the conversion action is created with type=UPLOAD_CLICKS (required for API-uploaded offline conversions, immutable after creation). The type field carries the Google ConversionActionCategory enum value, e.g. PURCHASE, SUBSCRIBE_PAID, SIGNUP, IMPORTED_LEAD, BOOK_APPOINTMENT. Unified standard event names (e.g. Purchase, Subscribe, CompleteRegistration, Lead, Schedule) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass primaryForGoal: true to opt in.
382 383 384 385 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 382 def create_conversion_destination(account_id, create_conversion_destination_request, opts = {}) data, _status_code, _headers = create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts) data end |
#create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts = {}) ⇒ Array<(CreateConversionDestination201Response, Integer, Hash)>
Create a conversion destination Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta manages destinations in its own UI and returns 405. LinkedIn: creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. Google Ads: calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed `IDEMPOTENCY_CONFLICT` (409) rather than silently returning the mismatched action. LinkedIn: the rule is created with `conversionMethod=CONVERSIONS_API` and (by default) auto-associated with all of the ad account's campaigns via `autoAssociationType=ALL_CAMPAIGNS`. Pass `autoAssociationType: NONE` to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for `SUBMIT_APPLICATION`, `PURCHASE`, `ADD_TO_CART`, `QUALIFIED_LEAD`, and `LEAD` rule types; the API rejects other combinations locally. Google Ads: the conversion action is created with `type=UPLOAD_CLICKS` (required for API-uploaded offline conversions, immutable after creation). The `type` field carries the Google `ConversionActionCategory` enum value, e.g. `PURCHASE`, `SUBSCRIBE_PAID`, `SIGNUP`, `IMPORTED_LEAD`, `BOOK_APPOINTMENT`. Unified standard event names (e.g. `Purchase`, `Subscribe`, `CompleteRegistration`, `Lead`, `Schedule`) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass `primaryForGoal: true` to opt in.
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 393 def create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.create_conversion_destination ...' 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 AdsApi.create_conversion_destination" end # verify the required parameter 'create_conversion_destination_request' is set if @api_client.config.client_side_validation && create_conversion_destination_request.nil? fail ArgumentError, "Missing the required parameter 'create_conversion_destination_request' when calling AdsApi.create_conversion_destination" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(account_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(create_conversion_destination_request) # return_type return_type = opts[:debug_return_type] || 'CreateConversionDestination201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.create_conversion_destination", :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: AdsApi#create_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_ctwa_ad(create_ctwa_ad_request, opts = {}) ⇒ CreateCtwaAd201Response
Create Click-to-WhatsApp ad
Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - Single-creative: supply top-level headline, body, and one of imageUrl / video. Creates 1 campaign + 1 ad set + 1 ad. - Multi-creative: supply a creatives[] array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
455 456 457 458 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 455 def create_ctwa_ad(create_ctwa_ad_request, opts = {}) data, _status_code, _headers = create_ctwa_ad_with_http_info(create_ctwa_ad_request, opts) data end |
#create_ctwa_ad_with_http_info(create_ctwa_ad_request, opts = {}) ⇒ Array<(CreateCtwaAd201Response, Integer, Hash)>
Create Click-to-WhatsApp ad Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - Single-creative: supply top-level `headline`, `body`, and one of `imageUrl` / `video`. Creates 1 campaign + 1 ad set + 1 ad. - Multi-creative: supply a `creatives` array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 465 def create_ctwa_ad_with_http_info(create_ctwa_ad_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.create_ctwa_ad ...' end # verify the required parameter 'create_ctwa_ad_request' is set if @api_client.config.client_side_validation && create_ctwa_ad_request.nil? fail ArgumentError, "Missing the required parameter 'create_ctwa_ad_request' when calling AdsApi.create_ctwa_ad" end # resource path local_var_path = '/v1/ads/ctwa' # 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_ctwa_ad_request) # return_type return_type = opts[:debug_return_type] || 'CreateCtwaAd201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.create_ctwa_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: AdsApi#create_ctwa_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_lead_form(create_lead_form_request, opts = {}) ⇒ CreateLeadForm200Response
Create a lead form Creates a Lead Gen form on the connected Facebook Page (POST /page-id/leadgen_forms). NOT idempotent — a retry creates a second form. Prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. Requires the Ads add-on.
523 524 525 526 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 523 def create_lead_form(create_lead_form_request, opts = {}) data, _status_code, _headers = create_lead_form_with_http_info(create_lead_form_request, opts) data end |
#create_lead_form_with_http_info(create_lead_form_request, opts = {}) ⇒ Array<(CreateLeadForm200Response, Integer, Hash)>
Create a lead form Creates a Lead Gen form on the connected Facebook Page (POST /page-id/leadgen_forms). NOT idempotent — a retry creates a second form. Prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. Requires the Ads add-on.
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 533 def create_lead_form_with_http_info(create_lead_form_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.create_lead_form ...' end # verify the required parameter 'create_lead_form_request' is set if @api_client.config.client_side_validation && create_lead_form_request.nil? fail ArgumentError, "Missing the required parameter 'create_lead_form_request' when calling AdsApi.create_lead_form" end # resource path local_var_path = '/v1/ads/lead-forms' # 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_lead_form_request) # return_type return_type = opts[:debug_return_type] || 'CreateLeadForm200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.create_lead_form", :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: AdsApi#create_lead_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_standalone_ad(create_standalone_ad_request, opts = {}) ⇒ CreateStandaloneAd201Response
Create standalone ad
Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, and LinkedIn. Supports three mutually-exclusive request shapes selected by the body, a legacy single-creative shape (all platforms, default), a Meta-only multi-creative shape via the creatives array (one ad set with N ads sharing budget and targeting), and a Meta-only attach shape via adSetId (adds one new ad to an existing ad set). 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.
592 593 594 595 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 592 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<(CreateStandaloneAd201Response, Integer, Hash)>
Create standalone ad Creates a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X/Twitter, and LinkedIn. Supports three mutually-exclusive request shapes selected by the body, a legacy single-creative shape (all platforms, default), a Meta-only multi-creative shape via the creatives array (one ad set with N ads sharing budget and targeting), and a Meta-only attach shape via adSetId (adds one new ad to an existing ad set). 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.
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 603 def create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.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 AdsApi.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] || 'CreateStandaloneAd201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.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: AdsApi#create_standalone_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_test_lead(form_id, create_test_lead_request, opts = {}) ⇒ CreateTestLead200Response
Create a test lead Submits a test lead against the form (POST /form-id/test_leads) to exercise retrieval without waiting for real ad impressions. Meta allows one test lead per form at a time.
667 668 669 670 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 667 def create_test_lead(form_id, create_test_lead_request, opts = {}) data, _status_code, _headers = create_test_lead_with_http_info(form_id, create_test_lead_request, opts) data end |
#create_test_lead_with_http_info(form_id, create_test_lead_request, opts = {}) ⇒ Array<(CreateTestLead200Response, Integer, Hash)>
Create a test lead Submits a test lead against the form (POST /form-id/test_leads) to exercise retrieval without waiting for real ad impressions. Meta allows one test lead per form at a time.
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 678 def create_test_lead_with_http_info(form_id, create_test_lead_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.create_test_lead ...' end # verify the required parameter 'form_id' is set if @api_client.config.client_side_validation && form_id.nil? fail ArgumentError, "Missing the required parameter 'form_id' when calling AdsApi.create_test_lead" end # verify the required parameter 'create_test_lead_request' is set if @api_client.config.client_side_validation && create_test_lead_request.nil? fail ArgumentError, "Missing the required parameter 'create_test_lead_request' when calling AdsApi.create_test_lead" end # resource path local_var_path = '/v1/ads/lead-forms/{formId}/test-leads'.sub('{' + 'formId' + '}', CGI.escape(form_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(create_test_lead_request) # return_type return_type = opts[:debug_return_type] || 'CreateTestLead200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.create_test_lead", :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: AdsApi#create_test_lead\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.
740 741 742 743 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 740 def delete_ad(ad_id, opts = {}) data, _status_code, _headers = delete_ad_with_http_info(ad_id, opts) data 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.
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 750 def delete_ad_with_http_info(ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.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 => :"AdsApi.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: AdsApi#delete_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_conversion_destination(account_id, destination_id, opts = {}) ⇒ nil
Delete a conversion destination
LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls "delete" is the same enabled: false flip we apply here. The rule remains fetchable via GET with status: 'inactive'; the unified discovery endpoint hides it by default. adAccountId may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.
805 806 807 808 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 805 def delete_conversion_destination(account_id, destination_id, opts = {}) delete_conversion_destination_with_http_info(account_id, destination_id, opts) nil end |
#delete_conversion_destination_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete a conversion destination LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls "delete" is the same `enabled: false` flip we apply here. The rule remains fetchable via GET with `status: 'inactive'`; the unified discovery endpoint hides it by default. `adAccountId` may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 817 def delete_conversion_destination_with_http_info(account_id, destination_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.delete_conversion_destination ...' 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 AdsApi.delete_conversion_destination" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.delete_conversion_destination" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_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] # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.delete_conversion_destination", :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: AdsApi#delete_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#estimate_ad_reach(estimate_ad_reach_request, opts = {}) ⇒ EstimateAdReach200Response
Estimate audience reach
Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created. Backed by each platform's native reach API (Meta delivery_estimate, LinkedIn audienceCounts, X audience_summary, Pinterest audience_sizing). Platforms without a usable pre-flight reach API (Google Search/Display, TikTok) return available: false with no bounds, so clients can hide or grey out the estimate rather than treat the absence as an error.
875 876 877 878 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 875 def estimate_ad_reach(estimate_ad_reach_request, opts = {}) data, _status_code, _headers = estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts) data end |
#estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {}) ⇒ Array<(EstimateAdReach200Response, Integer, Hash)>
Estimate audience reach Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created. Backed by each platform's native reach API (Meta `delivery_estimate`, LinkedIn `audienceCounts`, X `audience_summary`, Pinterest `audience_sizing`). Platforms without a usable pre-flight reach API (Google Search/Display, TikTok) return `available: false` with no bounds, so clients can hide or grey out the estimate rather than treat the absence as an error.
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 885 def estimate_ad_reach_with_http_info(estimate_ad_reach_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.estimate_ad_reach ...' end # verify the required parameter 'estimate_ad_reach_request' is set if @api_client.config.client_side_validation && estimate_ad_reach_request.nil? fail ArgumentError, "Missing the required parameter 'estimate_ad_reach_request' when calling AdsApi.estimate_ad_reach" end # resource path local_var_path = '/v1/ads/targeting/reach-estimate' # 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(estimate_ad_reach_request) # return_type return_type = opts[:debug_return_type] || 'EstimateAdReach200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.estimate_ad_reach", :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: AdsApi#estimate_ad_reach\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad(ad_id, opts = {}) ⇒ GetAd200Response
Get ad details
Returns an ad with its creative, targeting, status, and performance metrics. The {adId} path segment accepts any identifier dialect Zernio indexes for the ad: - the Zernio internal _id (24-char hex) - Meta's numeric platformAdId (the value shipped in comment.received webhooks as comment.ad.id) - the creative's effective_object_story_id ({pageId}_{postId} shape, Facebook side) - the creative's effective_instagram_media_id (Instagram side) Any of the four resolve to the same ad. Caller doesn't need a translation step.
943 944 945 946 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 943 def get_ad(ad_id, opts = {}) data, _status_code, _headers = get_ad_with_http_info(ad_id, opts) data end |
#get_ad_analytics(ad_id, opts = {}) ⇒ GetAdAnalytics200Response
Get ad analytics Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
1009 1010 1011 1012 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1009 def get_ad_analytics(ad_id, opts = {}) data, _status_code, _headers = get_ad_analytics_with_http_info(ad_id, opts) data end |
#get_ad_analytics_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdAnalytics200Response, Integer, Hash)>
Get ad analytics Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1022 def get_ad_analytics_with_http_info(ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_analytics ...' 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 AdsApi.get_ad_analytics" end # resource path local_var_path = '/v1/ads/{adId}/analytics'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].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] || 'GetAdAnalytics200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_ad_analytics", :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: AdsApi#get_ad_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad_comments(ad_id, opts = {}) ⇒ GetAdComments200Response
List comments on an ad
Returns comments on an ad's underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/postId endpoint cannot serve because dark posts are not in Zernio's post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative's effective_object_story_id and effective_instagram_media_id). Use the placement query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account's token. If no connected Instagram account on the profile can read the ad's media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement=facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/postId. The {adId} path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal _id (24-char hex), Meta's numeric platformAdId (the value shipped in comment.received webhooks as comment.ad.id), or the creative's effective_object_story_id / effective_instagram_media_id. Caller doesn't need a translation step.
1081 1082 1083 1084 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1081 def get_ad_comments(ad_id, opts = {}) data, _status_code, _headers = get_ad_comments_with_http_info(ad_id, opts) data end |
#get_ad_comments_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdComments200Response, Integer, Hash)>
List comments on an ad Returns comments on an ad's underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/postId endpoint cannot serve because dark posts are not in Zernio's post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative's effective_object_story_id and effective_instagram_media_id). Use the `placement` query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account's token. If no connected Instagram account on the profile can read the ad's media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement=facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/postId. The `adId` path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal `_id` (24-char hex), Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`), or the creative's `effective_object_story_id` / `effective_instagram_media_id`. Caller doesn't need a translation step.
1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1094 def get_ad_comments_with_http_info(ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_comments ...' 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 AdsApi.get_ad_comments" end allowable_values = ["facebook", "instagram"] if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement']) fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.get_ad_comments, 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 AdsApi.get_ad_comments, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/{adId}/comments'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'placement'] = opts[:'placement'] if !opts[:'placement'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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] || 'GetAdComments200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_ad_comments", :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: AdsApi#get_ad_comments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad_insights_report(report_run_id, account_id, opts = {}) ⇒ GetAdInsightsReport200Response
Poll an async insights report run (Meta)
Status and results for a report run created via POST /v1/ads/insights/reports. While the job runs, returns status and percentCompletion. Once status is "Job Completed" the response also carries a data page, cursor-paginated via limit / after.
1165 1166 1167 1168 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1165 def get_ad_insights_report(report_run_id, account_id, opts = {}) data, _status_code, _headers = get_ad_insights_report_with_http_info(report_run_id, account_id, opts) data end |
#get_ad_insights_report_with_http_info(report_run_id, account_id, opts = {}) ⇒ Array<(GetAdInsightsReport200Response, Integer, Hash)>
Poll an async insights report run (Meta) Status and results for a report run created via POST /v1/ads/insights/reports. While the job runs, returns `status` and `percentCompletion`. Once `status` is "Job Completed" the response also carries a `data` page, cursor-paginated via `limit` / `after`.
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1178 def get_ad_insights_report_with_http_info(report_run_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_insights_report ...' end # verify the required parameter 'report_run_id' is set if @api_client.config.client_side_validation && report_run_id.nil? fail ArgumentError, "Missing the required parameter 'report_run_id' when calling AdsApi.get_ad_insights_report" 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 AdsApi.get_ad_insights_report" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.get_ad_insights_report, 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 AdsApi.get_ad_insights_report, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/insights/reports/{reportRunId}'.sub('{' + 'reportRunId' + '}', CGI.escape(report_run_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetAdInsightsReport200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_ad_insights_report", :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: AdsApi#get_ad_insights_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad_tracking_tags(ad_id, opts = {}) ⇒ GetAdTrackingTags200Response
Get ad tracking tags
Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's url_tags (and template_url_spec). - Google (googleads): the campaign's trackingUrlTemplate + finalUrlSuffix. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM dynamicValueParameters + customValueParameters. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).
1246 1247 1248 1249 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1246 def (ad_id, opts = {}) data, _status_code, _headers = (ad_id, opts) data end |
#get_ad_tracking_tags_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAdTrackingTags200Response, Integer, Hash)>
Get ad tracking tags Unified read of the platform's native click-URL tracking params. - Meta (facebook/instagram): the creative's `url_tags` (and template_url_spec). - Google (googleads): the campaign's `trackingUrlTemplate` + `finalUrlSuffix`. Subject to the Google Ads API access-tier daily quota; bulk audits need Standard access. - LinkedIn (linkedinads): the campaign's Dynamic UTM `dynamicValueParameters` + `customValueParameters`. Returns 405 for platforms without a click-URL tracking surface (TikTok, X, Pinterest).
1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1256 def (ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_tracking_tags ...' 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 AdsApi.get_ad_tracking_tags" end # resource path local_var_path = '/v1/ads/{adId}/tracking-tags'.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] || 'GetAdTrackingTags200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_ad_tracking_tags", :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: AdsApi#get_ad_tracking_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_ad_with_http_info(ad_id, opts = {}) ⇒ Array<(GetAd200Response, Integer, Hash)>
Get ad details Returns an ad with its creative, targeting, status, and performance metrics. The `adId` path segment accepts any identifier dialect Zernio indexes for the ad: - the Zernio internal `_id` (24-char hex) - Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`) - the creative's `effective_object_story_id` (`pageId_postId` shape, Facebook side) - the creative's `effective_instagram_media_id` (Instagram side) Any of the four resolve to the same ad. Caller doesn't need a translation step.
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 953 def get_ad_with_http_info(ad_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.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 => :"AdsApi.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: AdsApi#get_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_campaign_analytics(campaign_id, opts = {}) ⇒ GetCampaignAnalytics200Response
Get campaign analytics
Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns. Breakdowns are fetched live from Meta at the campaign level (one call per dimension, no per-ad fan-out), so an agency dashboard gets campaign-level age/gender/etc. without summing thousands of per-ad reads. campaignId is the platform campaign id; pass platform when a campaign id could be ambiguous across platforms. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
1313 1314 1315 1316 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1313 def get_campaign_analytics(campaign_id, opts = {}) data, _status_code, _headers = get_campaign_analytics_with_http_info(campaign_id, opts) data end |
#get_campaign_analytics_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetCampaignAnalytics200Response, Integer, Hash)>
Get campaign analytics Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns. Breakdowns are fetched live from Meta at the campaign level (one call per dimension, no per-ad fan-out), so an agency dashboard gets campaign-level age/gender/etc. without summing thousands of per-ad reads. `campaignId` is the platform campaign id; pass `platform` when a campaign id could be ambiguous across platforms. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1327 def get_campaign_analytics_with_http_info(campaign_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_campaign_analytics ...' 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 AdsApi.get_campaign_analytics" end # resource path local_var_path = '/v1/ads/campaigns/{campaignId}/analytics'.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[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].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] || 'GetCampaignAnalytics200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_campaign_analytics", :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: AdsApi#get_campaign_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_conversion_destination(account_id, destination_id, ad_account_id, opts = {}) ⇒ GetConversionDestination200Response
Get a conversion destination
LinkedIn-only today. Returns the full destination record for one conversion rule. The adAccountId query parameter is required because LinkedIn rules are scoped to a sponsored ad account.
1386 1387 1388 1389 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1386 def get_conversion_destination(account_id, destination_id, ad_account_id, opts = {}) data, _status_code, _headers = get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts) data end |
#get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>
Get a conversion destination LinkedIn-only today. Returns the full destination record for one conversion rule. The `adAccountId` query parameter is required because LinkedIn rules are scoped to a sponsored ad account.
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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1398 def get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_conversion_destination ...' 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 AdsApi.get_conversion_destination" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.get_conversion_destination" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_conversion_destination" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'adAccountId'] = ad_account_id # 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] || 'GetConversionDestination200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_conversion_destination", :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: AdsApi#get_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_conversion_metrics(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ GetConversionMetrics200Response
Get attribution metrics
LinkedIn-only today. Returns conversion-attribution metrics (externalWebsiteConversions, externalWebsitePostClickConversions, externalWebsitePostViewConversions, conversionValueInLocalCurrency, qualifiedLeads, costInLocalCurrency) bucketed by date. Date-range constraints (passed through from LinkedIn): - granularity=DAILY is retained for ~6 months only - granularity=ALL with a range > 6 months auto-rounds to month boundaries - granularity=MONTHLY/YEARLY retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.
1465 1466 1467 1468 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1465 def get_conversion_metrics(account_id, destination_id, ad_account_id, start_date, opts = {}) data, _status_code, _headers = get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts) data end |
#get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts = {}) ⇒ Array<(GetConversionMetrics200Response, Integer, Hash)>
Get attribution metrics LinkedIn-only today. Returns conversion-attribution metrics (`externalWebsiteConversions`, `externalWebsitePostClickConversions`, `externalWebsitePostViewConversions`, `conversionValueInLocalCurrency`, `qualifiedLeads`, `costInLocalCurrency`) bucketed by date. Date-range constraints (passed through from LinkedIn): - `granularity=DAILY` is retained for ~6 months only - `granularity=ALL` with a range > 6 months auto-rounds to month boundaries - `granularity=MONTHLY`/`YEARLY` retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 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 1555 1556 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1480 def get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_conversion_metrics ...' 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 AdsApi.get_conversion_metrics" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.get_conversion_metrics" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_conversion_metrics" end # verify the required parameter 'start_date' is set if @api_client.config.client_side_validation && start_date.nil? fail ArgumentError, "Missing the required parameter 'start_date' when calling AdsApi.get_conversion_metrics" end pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/) if @api_client.config.client_side_validation && start_date !~ pattern fail ArgumentError, "invalid value for 'start_date' when calling AdsApi.get_conversion_metrics, must conform to the pattern #{pattern}." end pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/) if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"end_date\"]' when calling AdsApi.get_conversion_metrics, must conform to the pattern #{pattern}." end allowable_values = ["ALL", "DAILY", "MONTHLY", "YEARLY"] if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity']) fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/metrics'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'adAccountId'] = ad_account_id query_params[:'startDate'] = start_date query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].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] || 'GetConversionMetrics200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_conversion_metrics", :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: AdsApi#get_conversion_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_conversions_quality(account_id, destination_id, opts = {}) ⇒ GetConversionsQuality200Response
Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.
1564 1565 1566 1567 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1564 def get_conversions_quality(account_id, destination_id, opts = {}) data, _status_code, _headers = get_conversions_quality_with_http_info(account_id, destination_id, opts) data end |
#get_conversions_quality_with_http_info(account_id, destination_id, opts = {}) ⇒ Array<(GetConversionsQuality200Response, Integer, Hash)>
Get Event Match Quality Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.
1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1575 def get_conversions_quality_with_http_info(account_id, destination_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_conversions_quality ...' 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 AdsApi.get_conversions_quality" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.get_conversions_quality" end # resource path local_var_path = '/v1/ads/conversions/quality' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'destinationId'] = destination_id # 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] || 'GetConversionsQuality200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_conversions_quality", :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: AdsApi#get_conversions_quality\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_dsa_defaults(account_id, ad_account_id, opts = {}) ⇒ UpdateAdAccount200Response
Get ad account DSA defaults
Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via PATCH /v1/ads/accounts or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.
1635 1636 1637 1638 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1635 def get_dsa_defaults(account_id, ad_account_id, opts = {}) data, _status_code, _headers = get_dsa_defaults_with_http_info(account_id, ad_account_id, opts) data end |
#get_dsa_defaults_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(UpdateAdAccount200Response, Integer, Hash)>
Get ad account DSA defaults Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via `PATCH /v1/ads/accounts` or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.
1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1646 def get_dsa_defaults_with_http_info(account_id, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_dsa_defaults ...' 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 AdsApi.get_dsa_defaults" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_dsa_defaults" end # resource path local_var_path = '/v1/ads/dsa-defaults' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'adAccountId'] = ad_account_id # 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] || 'UpdateAdAccount200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_dsa_defaults", :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: AdsApi#get_dsa_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_dsa_recommendations(account_id, ad_account_id, opts = {}) ⇒ GetDsaRecommendations200Response
List DSA beneficiary/payor suggestions
Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity. Useful for prefilling dsaBeneficiary/dsaPayor inputs, or the defaults sent to PATCH /v1/ads/accounts, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.
1706 1707 1708 1709 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1706 def get_dsa_recommendations(account_id, ad_account_id, opts = {}) data, _status_code, _headers = get_dsa_recommendations_with_http_info(account_id, ad_account_id, opts) data end |
#get_dsa_recommendations_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(GetDsaRecommendations200Response, Integer, Hash)>
List DSA beneficiary/payor suggestions Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity. Useful for prefilling `dsaBeneficiary`/`dsaPayor` inputs, or the defaults sent to `PATCH /v1/ads/accounts`, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.
1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1717 def get_dsa_recommendations_with_http_info(account_id, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_dsa_recommendations ...' 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 AdsApi.get_dsa_recommendations" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.get_dsa_recommendations" end # resource path local_var_path = '/v1/ads/dsa-recommendations' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'adAccountId'] = ad_account_id # 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] || 'GetDsaRecommendations200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_dsa_recommendations", :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: AdsApi#get_dsa_recommendations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_lead_form(form_id, account_id, opts = {}) ⇒ GetLeadForm200Response
Get a lead form
1776 1777 1778 1779 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1776 def get_lead_form(form_id, account_id, opts = {}) data, _status_code, _headers = get_lead_form_with_http_info(form_id, account_id, opts) data end |
#get_lead_form_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(GetLeadForm200Response, Integer, Hash)>
Get a lead form
1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1786 def get_lead_form_with_http_info(form_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_lead_form ...' end # verify the required parameter 'form_id' is set if @api_client.config.client_side_validation && form_id.nil? fail ArgumentError, "Missing the required parameter 'form_id' when calling AdsApi.get_lead_form" 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 AdsApi.get_lead_form" end # resource path local_var_path = '/v1/ads/lead-forms/{formId}'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id # 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] || 'GetLeadForm200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_lead_form", :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: AdsApi#get_lead_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {}) ⇒ GetLinkedInBidPricing200Response
Suggested bid and budget bounds (LinkedIn)
LinkedIn-only. Returns the suggested bid and bid limits for a targeting spec, plus the daily-budget bounds LinkedIn will accept. Use it before creating a campaign to pick a bid inside the allowed range and warn the user if their daily budget is below the minimum. Wraps LinkedIn's adBudgetPricing finder. Non-LinkedIn accounts return available: false so clients can hide the pricing UI without treating it as a failure.
1844 1845 1846 1847 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1844 def get_linked_in_bid_pricing(get_linked_in_bid_pricing_request, opts = {}) data, _status_code, _headers = get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts) data end |
#get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {}) ⇒ Array<(GetLinkedInBidPricing200Response, Integer, Hash)>
Suggested bid and budget bounds (LinkedIn) LinkedIn-only. Returns the suggested bid and bid limits for a targeting spec, plus the daily-budget bounds LinkedIn will accept. Use it before creating a campaign to pick a bid inside the allowed range and warn the user if their daily budget is below the minimum. Wraps LinkedIn's `adBudgetPricing` finder. Non-LinkedIn accounts return `available: false` so clients can hide the pricing UI without treating it as a failure.
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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1854 def get_linked_in_bid_pricing_with_http_info(get_linked_in_bid_pricing_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_linked_in_bid_pricing ...' end # verify the required parameter 'get_linked_in_bid_pricing_request' is set if @api_client.config.client_side_validation && get_linked_in_bid_pricing_request.nil? fail ArgumentError, "Missing the required parameter 'get_linked_in_bid_pricing_request' when calling AdsApi.get_linked_in_bid_pricing" end # resource path local_var_path = '/v1/ads/targeting/bid-pricing' # 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(get_linked_in_bid_pricing_request) # return_type return_type = opts[:debug_return_type] || 'GetLinkedInBidPricing200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_linked_in_bid_pricing", :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: AdsApi#get_linked_in_bid_pricing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {}) ⇒ GetLinkedInSupplyForecast200Response
Impressions, clicks and spend forecast (LinkedIn)
LinkedIn-only. Forecasted impressions, clicks, spend and ~20 other metrics for a targeting spec over a time range. Wraps LinkedIn's adSupplyForecasts finder. Each returned series carries a metricType (IMPRESSION, CLICK, SPENDING, MAX_POTENTIAL_BUDGET, COST_PER_MILLION_IMPRESSIONS, ...) and a granularity (DAILY, SEVEN_DAY, THIRTY_DAY, CUSTOM). LinkedIn caps the daily spending forecast at 1.2x the daily budget and returns 0 once the total budget is exhausted. Non-LinkedIn accounts return available: false.
1912 1913 1914 1915 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1912 def get_linked_in_supply_forecast(get_linked_in_supply_forecast_request, opts = {}) data, _status_code, _headers = get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts) data end |
#get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {}) ⇒ Array<(GetLinkedInSupplyForecast200Response, Integer, Hash)>
Impressions, clicks and spend forecast (LinkedIn) LinkedIn-only. Forecasted impressions, clicks, spend and ~20 other metrics for a targeting spec over a time range. Wraps LinkedIn's `adSupplyForecasts` finder. Each returned series carries a `metricType` (IMPRESSION, CLICK, SPENDING, MAX_POTENTIAL_BUDGET, COST_PER_MILLION_IMPRESSIONS, ...) and a `granularity` (DAILY, SEVEN_DAY, THIRTY_DAY, CUSTOM). LinkedIn caps the daily spending forecast at 1.2x the daily budget and returns 0 once the total budget is exhausted. Non-LinkedIn accounts return `available: false`.
1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1922 def get_linked_in_supply_forecast_with_http_info(get_linked_in_supply_forecast_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.get_linked_in_supply_forecast ...' end # verify the required parameter 'get_linked_in_supply_forecast_request' is set if @api_client.config.client_side_validation && get_linked_in_supply_forecast_request.nil? fail ArgumentError, "Missing the required parameter 'get_linked_in_supply_forecast_request' when calling AdsApi.get_linked_in_supply_forecast" end # resource path local_var_path = '/v1/ads/targeting/supply-forecast' # 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(get_linked_in_supply_forecast_request) # return_type return_type = opts[:debug_return_type] || 'GetLinkedInSupplyForecast200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.get_linked_in_supply_forecast", :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: AdsApi#get_linked_in_supply_forecast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ad_accounts(account_id, opts = {}) ⇒ ListAdAccounts200Response
List ad accounts
Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's /advertiser/info/ endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time advertiser_ids list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.
1982 1983 1984 1985 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1982 def list_ad_accounts(account_id, opts = {}) data, _status_code, _headers = list_ad_accounts_with_http_info(account_id, opts) data end |
#list_ad_accounts_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdAccounts200Response, Integer, Hash)>
List ad accounts Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.
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 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 1994 def list_ad_accounts_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_accounts ...' 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 AdsApi.list_ad_accounts" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_accounts, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_accounts, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/accounts' # 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[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'ListAdAccounts200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_ad_accounts", :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: AdsApi#list_ad_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ad_catalog_product_sets(catalog_id, account_id, opts = {}) ⇒ ListAdCatalogProductSets200Response
List a catalog's product sets
Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as promotedObject.productSetId on POST /v1/ads/create with goal: catalog_sales.
2059 2060 2061 2062 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2059 def list_ad_catalog_product_sets(catalog_id, account_id, opts = {}) data, _status_code, _headers = list_ad_catalog_product_sets_with_http_info(catalog_id, account_id, opts) data end |
#list_ad_catalog_product_sets_with_http_info(catalog_id, account_id, opts = {}) ⇒ Array<(ListAdCatalogProductSets200Response, Integer, Hash)>
List a catalog's product sets Lists a Meta product catalog's product sets — the unit a catalog ad promotes. Pass the chosen set as `promotedObject.productSetId` on POST /v1/ads/create with `goal: catalog_sales`.
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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2070 def list_ad_catalog_product_sets_with_http_info(catalog_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_catalog_product_sets ...' end # verify the required parameter 'catalog_id' is set if @api_client.config.client_side_validation && catalog_id.nil? fail ArgumentError, "Missing the required parameter 'catalog_id' when calling AdsApi.list_ad_catalog_product_sets" 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 AdsApi.list_ad_catalog_product_sets" end # resource path local_var_path = '/v1/ads/catalogs/{catalogId}/product-sets'.sub('{' + 'catalogId' + '}', CGI.escape(catalog_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListAdCatalogProductSets200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_ad_catalog_product_sets", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#list_ad_catalog_product_sets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ad_catalogs(account_id, ad_account_id, opts = {}) ⇒ ListAdCatalogs200Response
List Meta product catalogs
Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (goal: catalog_sales on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.
2129 2130 2131 2132 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2129 def list_ad_catalogs(account_id, ad_account_id, opts = {}) data, _status_code, _headers = list_ad_catalogs_with_http_info(account_id, ad_account_id, opts) data end |
#list_ad_catalogs_with_http_info(account_id, ad_account_id, opts = {}) ⇒ Array<(ListAdCatalogs200Response, Integer, Hash)>
List Meta product catalogs Lists the Meta product catalogs reachable from an ad account (owned + agency-shared catalogs of the ad account's business), for Advantage+ catalog ads (`goal: catalog_sales` on POST /v1/ads/create — e.g. vehicle inventory catalogs). Read-only; uses scopes customers already granted (no reconnect needed). Catalog contents (items, feeds) are managed in Meta Commerce Manager, not through this API.
2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2140 def list_ad_catalogs_with_http_info(account_id, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_catalogs ...' 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 AdsApi.list_ad_catalogs" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_ad_catalogs" end # resource path local_var_path = '/v1/ads/catalogs' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'adAccountId'] = ad_account_id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListAdCatalogs200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_ad_catalogs", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: AdsApi#list_ad_catalogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ads(opts = {}) ⇒ ListAds200Response
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.
2212 2213 2214 2215 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2212 def list_ads(opts = {}) data, _status_code, _headers = list_ads_with_http_info(opts) data end |
#list_ads_business_centers(account_id, opts = {}) ⇒ ListAdsBusinessCenters200Response
List TikTok Business Centers
Returns the TikTok Business Centers (BCs) the connected tiktokads account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking /v1/ads/accounts per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.
2318 2319 2320 2321 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2318 def list_ads_business_centers(account_id, opts = {}) data, _status_code, _headers = list_ads_business_centers_with_http_info(account_id, opts) data end |
#list_ads_business_centers_with_http_info(account_id, opts = {}) ⇒ Array<(ListAdsBusinessCenters200Response, Integer, Hash)>
List TikTok Business Centers Returns the TikTok Business Centers (BCs) the connected `tiktokads` account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking `/v1/ads/accounts` per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2328 def list_ads_business_centers_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_ads_business_centers ...' 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 AdsApi.list_ads_business_centers" end # resource path local_var_path = '/v1/ads/business-centers' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id # 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] || 'ListAdsBusinessCenters200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_ads_business_centers", :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: AdsApi#list_ads_business_centers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_ads_with_http_info(opts = {}) ⇒ Array<(ListAds200Response, 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.
2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2235 def list_ads_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.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 AdsApi.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 AdsApi.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"] 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[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil? query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? query_params[:'platformAdId'] = opts[:'platform_ad_id'] if !opts[:'platform_ad_id'].nil? query_params[:'effectiveObjectStoryId'] = opts[:'effective_object_story_id'] if !opts[:'effective_object_story_id'].nil? query_params[:'effectiveInstagramMediaId'] = opts[:'effective_instagram_media_id'] if !opts[:'effective_instagram_media_id'].nil? query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil? query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListAds200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.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: AdsApi#list_ads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_conversion_associations(account_id, destination_id, ad_account_id, opts = {}) ⇒ ListConversionAssociations200Response
List associated campaigns LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.
2384 2385 2386 2387 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2384 def list_conversion_associations(account_id, destination_id, ad_account_id, opts = {}) data, _status_code, _headers = list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts) data end |
#list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts = {}) ⇒ Array<(ListConversionAssociations200Response, Integer, Hash)>
List associated campaigns LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.
2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2396 def list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_conversion_associations ...' 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 AdsApi.list_conversion_associations" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.list_conversion_associations" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_conversion_associations" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'adAccountId'] = ad_account_id # 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] || 'ListConversionAssociations200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_conversion_associations", :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: AdsApi#list_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_conversion_destinations(account_id, opts = {}) ⇒ ListConversionDestinations200Response
List conversion destinations
Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account. Use the returned id as destinationId when posting to POST /v1/ads/conversions. For Google and LinkedIn, each destination's type reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta, type is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the adAccountId field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).
2458 2459 2460 2461 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2458 def list_conversion_destinations(account_id, opts = {}) data, _status_code, _headers = list_conversion_destinations_with_http_info(account_id, opts) data end |
#list_conversion_destinations_with_http_info(account_id, opts = {}) ⇒ Array<(ListConversionDestinations200Response, Integer, Hash)>
List conversion destinations Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account. Use the returned `id` as `destinationId` when posting to `POST /v1/ads/conversions`. For Google and LinkedIn, each destination's `type` reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta, `type` is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the `adAccountId` field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).
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 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2468 def list_conversion_destinations_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_conversion_destinations ...' 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 AdsApi.list_conversion_destinations" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(account_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] || 'ListConversionDestinations200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_conversion_destinations", :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: AdsApi#list_conversion_destinations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_form_leads(form_id, account_id, opts = {}) ⇒ ListFormLeads200Response
List leads for a single form Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
2525 2526 2527 2528 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2525 def list_form_leads(form_id, account_id, opts = {}) data, _status_code, _headers = list_form_leads_with_http_info(form_id, account_id, opts) data end |
#list_form_leads_with_http_info(form_id, account_id, opts = {}) ⇒ Array<(ListFormLeads200Response, Integer, Hash)>
List leads for a single form Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
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 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2539 def list_form_leads_with_http_info(form_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_form_leads ...' end # verify the required parameter 'form_id' is set if @api_client.config.client_side_validation && form_id.nil? fail ArgumentError, "Missing the required parameter 'form_id' when calling AdsApi.list_form_leads" 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 AdsApi.list_form_leads" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_form_leads, 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 AdsApi.list_form_leads, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/lead-forms/{formId}/leads'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].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] || 'ListFormLeads200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_form_leads", :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: AdsApi#list_form_leads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_lead_forms(account_id, opts = {}) ⇒ ListLeadForms200Response
List lead forms Lists the Lead Gen forms owned by the connected Facebook Page. Requires the Ads add-on.
2610 2611 2612 2613 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2610 def list_lead_forms(account_id, opts = {}) data, _status_code, _headers = list_lead_forms_with_http_info(account_id, opts) data end |
#list_lead_forms_with_http_info(account_id, opts = {}) ⇒ Array<(ListLeadForms200Response, Integer, Hash)>
List lead forms Lists the Lead Gen forms owned by the connected Facebook Page. Requires the Ads add-on.
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 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2622 def list_lead_forms_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_lead_forms ...' 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 AdsApi.list_lead_forms" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_lead_forms, 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 AdsApi.list_lead_forms, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/lead-forms' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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] || 'ListLeadForms200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_lead_forms", :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: AdsApi#list_lead_forms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_leads(opts = {}) ⇒ ListLeads200Response
List submitted leads
Returns persisted Meta Lead Gen leads for your team, newest-first, with keyset pagination on cursor. Leads are ingested in real time from the leadgen webhook. Requires the Ads add-on.
2690 2691 2692 2693 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2690 def list_leads(opts = {}) data, _status_code, _headers = list_leads_with_http_info(opts) data end |
#list_leads_with_http_info(opts = {}) ⇒ Array<(ListLeads200Response, Integer, Hash)>
List submitted leads Returns persisted Meta Lead Gen leads for your team, newest-first, with keyset pagination on `cursor`. Leads are ingested in real time from the `leadgen` webhook. Requires the Ads add-on.
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2704 def list_leads_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_leads ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_leads, 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 AdsApi.list_leads, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/leads' # query parameters query_params = opts[:query_params] || {} query_params[:'formId'] = opts[:'form_id'] if !opts[:'form_id'].nil? query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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] || 'ListLeads200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_leads", :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: AdsApi#list_leads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_whats_app_conversions(account_id, opts = {}) ⇒ ListWhatsAppConversions200Response
List conversion events
Returns the most recent conversion events sent through POST /v1/whatsapp/conversions for the given WhatsApp account. Sourced from delivery logs (Axiom late dataset), so the visible window is bounded by log retention (about 30 days). Useful for rendering a "recent activity" panel on the conversions setup tab without standing up a parallel persistence layer. Per-event payload mirrors the structured log we write on every successful send: eventName, conversationId, eventsReceived, eventsFailed, traceId, durationMs, and the wall-clock timestamp.
2767 2768 2769 2770 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2767 def list_whats_app_conversions(account_id, opts = {}) data, _status_code, _headers = list_whats_app_conversions_with_http_info(account_id, opts) data end |
#list_whats_app_conversions_with_http_info(account_id, opts = {}) ⇒ Array<(ListWhatsAppConversions200Response, Integer, Hash)>
List conversion events Returns the most recent conversion events sent through `POST /v1/whatsapp/conversions` for the given WhatsApp account. Sourced from delivery logs (Axiom `late` dataset), so the visible window is bounded by log retention (about 30 days). Useful for rendering a "recent activity" panel on the conversions setup tab without standing up a parallel persistence layer. Per-event payload mirrors the structured log we write on every successful send: `eventName`, `conversationId`, `eventsReceived`, `eventsFailed`, `traceId`, `durationMs`, and the wall-clock `timestamp`.
2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2778 def list_whats_app_conversions_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.list_whats_app_conversions ...' 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 AdsApi.list_whats_app_conversions" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_whats_app_conversions, must be smaller than or equal to 200.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_whats_app_conversions, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/whatsapp/conversions' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'ListWhatsAppConversions200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.list_whats_app_conversions", :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: AdsApi#list_whats_app_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#query_ad_insights(account_id, object_id, opts = {}) ⇒ QueryAdInsights200Response
Flexible live insights query (Meta)
Live, flexible insights query against Meta's Graph API. Unlike GET /v1/ads/adId/analytics (fixed metric set, cached), this forwards caller-chosen fields, breakdowns and filtering to any Meta insights node and returns Meta's rows verbatim. objectId selects the node: an ad account, campaign, ad set or ad platform id. level sets row granularity independently of the node. Semantic validation is Meta's: an unknown field or invalid breakdown combination returns a 400 carrying Meta's message. For long ranges or agency-scale accounts prefer the async variant (POST /v1/ads/insights/reports). Meta only.
2852 2853 2854 2855 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2852 def query_ad_insights(account_id, object_id, opts = {}) data, _status_code, _headers = query_ad_insights_with_http_info(account_id, object_id, opts) data end |
#query_ad_insights_with_http_info(account_id, object_id, opts = {}) ⇒ Array<(QueryAdInsights200Response, Integer, Hash)>
Flexible live insights query (Meta) Live, flexible insights query against Meta's Graph API. Unlike GET /v1/ads/adId/analytics (fixed metric set, cached), this forwards caller-chosen `fields`, `breakdowns` and `filtering` to any Meta insights node and returns Meta's rows verbatim. `objectId` selects the node: an ad account, campaign, ad set or ad platform id. `level` sets row granularity independently of the node. Semantic validation is Meta's: an unknown field or invalid breakdown combination returns a 400 carrying Meta's message. For long ranges or agency-scale accounts prefer the async variant (POST /v1/ads/insights/reports). Meta only.
2873 2874 2875 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 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2873 def query_ad_insights_with_http_info(account_id, object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.query_ad_insights ...' 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 AdsApi.query_ad_insights" end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling AdsApi.query_ad_insights" end allowable_values = ["ad", "adset", "campaign", "account"] if @api_client.config.client_side_validation && opts[:'level'] && !allowable_values.include?(opts[:'level']) fail ArgumentError, "invalid value for \"level\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.query_ad_insights, 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 AdsApi.query_ad_insights, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/insights' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'objectId'] = object_id query_params[:'level'] = opts[:'level'] if !opts[:'level'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil? query_params[:'filtering'] = opts[:'filtering'] if !opts[:'filtering'].nil? query_params[:'datePreset'] = opts[:'date_preset'] if !opts[:'date_preset'].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[:'timeIncrement'] = opts[:'time_increment'] if !opts[:'time_increment'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'QueryAdInsights200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.query_ad_insights", :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: AdsApi#query_ad_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#remove_conversion_associations(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ RemoveConversionAssociations200Response
Remove associated campaigns
Remove one or more campaign associations from this conversion rule. Pass adAccountId and campaignIds as query parameters (campaignIds is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.
2957 2958 2959 2960 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2957 def remove_conversion_associations(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) data, _status_code, _headers = remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts) data end |
#remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) ⇒ Array<(RemoveConversionAssociations200Response, Integer, Hash)>
Remove associated campaigns Remove one or more campaign associations from this conversion rule. Pass `adAccountId` and `campaignIds` as query parameters (`campaignIds` is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.
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 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 2970 def remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.remove_conversion_associations ...' 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 AdsApi.remove_conversion_associations" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.remove_conversion_associations" end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.remove_conversion_associations" end # verify the required parameter 'campaign_ids' is set if @api_client.config.client_side_validation && campaign_ids.nil? fail ArgumentError, "Missing the required parameter 'campaign_ids' when calling AdsApi.remove_conversion_associations" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'adAccountId'] = ad_account_id query_params[:'campaignIds'] = campaign_ids # 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] || 'RemoveConversionAssociations200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.remove_conversion_associations", :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: AdsApi#remove_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search_ad_interests(q, account_id, opts = {}) ⇒ SearchAdInterests200Response
Search targeting interests
Deprecated alias for GET /v1/ads/targeting/search?dimension=interest. Kept for backward compatibility, it returns the legacy { interests: [...] } shape rather than the normalized { results: [...] }. New integrations should use GET /v1/ads/targeting/search with dimension=interest.
3038 3039 3040 3041 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3038 def search_ad_interests(q, account_id, opts = {}) data, _status_code, _headers = search_ad_interests_with_http_info(q, account_id, opts) data end |
#search_ad_interests_with_http_info(q, account_id, opts = {}) ⇒ Array<(SearchAdInterests200Response, Integer, Hash)>
Search targeting interests Deprecated alias for `GET /v1/ads/targeting/search?dimension=interest`. Kept for backward compatibility, it returns the legacy `{ interests: [...] }` shape rather than the normalized `{ results: [...] }`. New integrations should use `GET /v1/ads/targeting/search` with `dimension=interest`.
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 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3049 def search_ad_interests_with_http_info(q, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.search_ad_interests ...' end # verify the required parameter 'q' is set if @api_client.config.client_side_validation && q.nil? fail ArgumentError, "Missing the required parameter 'q' when calling AdsApi.search_ad_interests" 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 AdsApi.search_ad_interests" end # resource path local_var_path = '/v1/ads/interests' # query parameters query_params = opts[:query_params] || {} query_params[:'q'] = q query_params[:'accountId'] = account_id # 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] || 'SearchAdInterests200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.search_ad_interests", :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: AdsApi#search_ad_interests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search_ad_targeting(account_id, q, opts = {}) ⇒ SearchAdTargeting200Response
Search targeting options
Resolve a human-readable query into the platform's opaque targeting ids used in the TargetingSpec (countries/regions/cities/zips/metros geo keys, and interests/behaviors entity ids) on POST /v1/ads/create, POST /v1/ads/targeting/reach-estimate, and saved_targeting audiences. The dimension param selects what is searched, geo (locations, further scoped by geoType), interest, behavior, or income. Availability of each dimension varies by platform (e.g. behaviours are Meta/TikTok only). Results are normalized across platforms into a single shape, so the same client code consumes Meta, TikTok, LinkedIn, X, Pinterest, and Google results. For geo queries, q should contain only the locality name (e.g. \"Amsterdam\", not \"Amsterdam, NL\"). Use countryCode to disambiguate.
3113 3114 3115 3116 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3113 def search_ad_targeting(account_id, q, opts = {}) data, _status_code, _headers = search_ad_targeting_with_http_info(account_id, q, opts) data end |
#search_ad_targeting_with_http_info(account_id, q, opts = {}) ⇒ Array<(SearchAdTargeting200Response, Integer, Hash)>
Search targeting options Resolve a human-readable query into the platform's opaque targeting ids used in the `TargetingSpec` (`countries`/`regions`/`cities`/`zips`/`metros` geo keys, and `interests`/`behaviors` entity ids) on `POST /v1/ads/create`, `POST /v1/ads/targeting/reach-estimate`, and `saved_targeting` audiences. The `dimension` param selects what is searched, `geo` (locations, further scoped by `geoType`), `interest`, `behavior`, or `income`. Availability of each dimension varies by platform (e.g. behaviours are Meta/TikTok only). Results are normalized across platforms into a single shape, so the same client code consumes Meta, TikTok, LinkedIn, X, Pinterest, and Google results. For geo queries, `q` should contain only the locality name (e.g. `"Amsterdam"`, not `"Amsterdam, NL"`). Use `countryCode` to disambiguate.
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 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 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 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3128 def search_ad_targeting_with_http_info(account_id, q, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.search_ad_targeting ...' 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 AdsApi.search_ad_targeting" end # verify the required parameter 'q' is set if @api_client.config.client_side_validation && q.nil? fail ArgumentError, "Missing the required parameter 'q' when calling AdsApi.search_ad_targeting" end allowable_values = ["geo", "interest", "behavior", "income"] if @api_client.config.client_side_validation && opts[:'dimension'] && !allowable_values.include?(opts[:'dimension']) fail ArgumentError, "invalid value for \"dimension\", must be one of #{allowable_values}" end allowable_values = ["country", "region", "city", "zip", "metro"] if @api_client.config.client_side_validation && opts[:'geo_type'] && !allowable_values.include?(opts[:'geo_type']) fail ArgumentError, "invalid value for \"geo_type\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'country_code'].nil? && opts[:'country_code'].to_s.length > 2 fail ArgumentError, 'invalid value for "opts[:"country_code"]" when calling AdsApi.search_ad_targeting, the character length must be smaller than or equal to 2.' end if @api_client.config.client_side_validation && !opts[:'country_code'].nil? && opts[:'country_code'].to_s.length < 2 fail ArgumentError, 'invalid value for "opts[:"country_code"]" when calling AdsApi.search_ad_targeting, the character length must be greater than or equal to 2.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.search_ad_targeting, 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 AdsApi.search_ad_targeting, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/ads/targeting/search' # query parameters query_params = opts[:query_params] || {} query_params[:'accountId'] = account_id query_params[:'q'] = q query_params[:'dimension'] = opts[:'dimension'] if !opts[:'dimension'].nil? query_params[:'geoType'] = opts[:'geo_type'] if !opts[:'geo_type'].nil? query_params[:'countryCode'] = opts[:'country_code'] if !opts[:'country_code'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'SearchAdTargeting200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.search_ad_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: AdsApi#search_ad_targeting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#send_conversions(send_conversions_request, opts = {}) ⇒ SendConversions200Response
Send conversion events
Relay one or more conversion events to the target ad platform's native Conversions API. Platform is inferred from the provided accountId. Requires the Ads add-on. Supported platforms: - Meta (metaads) via Graph API - Google Ads (googleads) via Data Manager API ingestEvents - LinkedIn (linkedinads) via /rest/conversionEvents - TikTok (tiktokads) via the Offline Events API /offline/batch/ — OFFLINE conversions only destinationId semantics differ per platform: - Meta: pixel (dataset) ID, e.g. 123456789012345 - Google: conversion action resource name, e.g. customers/1234567890/conversionActions/987654321 - LinkedIn: conversion rule ID or URN, e.g. 104012 or urn:lla:llaPartnerConversion:104012 - TikTok: Offline Event Set ID, e.g. 7057103914977558530 TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. Callers can list valid destinations via GET /v1/accounts/{accountId}/conversion-destinations. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform's normalization spec, including Google's Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn externalIds are passed through as plaintext per LinkedIn's spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include rw_conversions). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. Dedup: pass a stable eventId on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to transactionId. Per-platform eventName semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta's built-in events; custom strings are accepted. - Google: ignored. The conversion action's category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule's type (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it.
3215 3216 3217 3218 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3215 def send_conversions(send_conversions_request, opts = {}) data, _status_code, _headers = send_conversions_with_http_info(send_conversions_request, opts) data end |
#send_conversions_with_http_info(send_conversions_request, opts = {}) ⇒ Array<(SendConversions200Response, Integer, Hash)>
Send conversion events Relay one or more conversion events to the target ad platform's native Conversions API. Platform is inferred from the provided `accountId`. Requires the Ads add-on. Supported platforms: - Meta (`metaads`) via Graph API - Google Ads (`googleads`) via Data Manager API `ingestEvents` - LinkedIn (`linkedinads`) via `/rest/conversionEvents` - TikTok (`tiktokads`) via the Offline Events API `/offline/batch/` — OFFLINE conversions only `destinationId` semantics differ per platform: - Meta: pixel (dataset) ID, e.g. `123456789012345` - Google: conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` - LinkedIn: conversion rule ID or URN, e.g. `104012` or `urn:lla:llaPartnerConversion:104012` - TikTok: Offline Event Set ID, e.g. `7057103914977558530` TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. Callers can list valid destinations via `GET /v1/accounts/accountId/conversion-destinations`. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform's normalization spec, including Google's Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn `externalIds` are passed through as plaintext per LinkedIn's spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include `rw_conversions`). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. Dedup: pass a stable `eventId` on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to `transactionId`. Per-platform `eventName` semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta's built-in events; custom strings are accepted. - Google: ignored. The conversion action's category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule's `type` (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it.
3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3225 def send_conversions_with_http_info(send_conversions_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.send_conversions ...' end # verify the required parameter 'send_conversions_request' is set if @api_client.config.client_side_validation && send_conversions_request.nil? fail ArgumentError, "Missing the required parameter 'send_conversions_request' when calling AdsApi.send_conversions" end # resource path local_var_path = '/v1/ads/conversions' # 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(send_conversions_request) # return_type return_type = opts[:debug_return_type] || 'SendConversions200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.send_conversions", :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: AdsApi#send_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#send_whats_app_conversion(send_whats_app_conversion_request, opts = {}) ⇒ SendWhatsAppConversion200Response
Send WhatsApp conversion event
Forward a WhatsApp Business Messaging conversion event (LeadSubmitted, Purchase, AddToCart, InitiateCheckout, ViewContent) to Meta's Conversions API with action_source = business_messaging and messaging_channel = whatsapp. The endpoint looks up the originating CTWA click ID (ctwa_clid) captured on the first inbound message of the conversation and replays it on every event so Meta can attribute the conversion back to the Click-to-WhatsApp ad that drove the chat. Configuration prerequisite on the WhatsApp account metadata: - metaCapiDatasetId: the Meta dataset ID linked to the WABA. Provision one with POST /v1/whatsapp/dataset. The WABA ID (already set automatically at connect time) is forwarded as user_data.whatsapp_business_account_id, which is the per-channel attribution identifier Meta requires for WhatsApp events. No Facebook Page ID is needed (that field is the Messenger-branch identifier). Identify the conversation by either conversationId (preferred) or phoneE164 (digits only, no +). At least one is required. If the conversation has no captured ctwa_clid, the request returns 422 because there is nothing to attribute. Token and dataset coupling: the WhatsApp account's accessToken must have access to the configured metaCapiDatasetId. By default a WABA's system-user token is scoped to the WABA's own Business Manager and cannot post to a pixel owned by a different Business; Meta returns code 100 in that case. Either share the dataset with the WhatsApp app's Business in BM, or use a dataset already in the same Business as the WABA.
3283 3284 3285 3286 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3283 def send_whats_app_conversion(send_whats_app_conversion_request, opts = {}) data, _status_code, _headers = send_whats_app_conversion_with_http_info(send_whats_app_conversion_request, opts) data end |
#send_whats_app_conversion_with_http_info(send_whats_app_conversion_request, opts = {}) ⇒ Array<(SendWhatsAppConversion200Response, Integer, Hash)>
Send WhatsApp conversion event Forward a WhatsApp Business Messaging conversion event (`LeadSubmitted`, `Purchase`, `AddToCart`, `InitiateCheckout`, `ViewContent`) to Meta's Conversions API with `action_source = business_messaging` and `messaging_channel = whatsapp`. The endpoint looks up the originating CTWA click ID (`ctwa_clid`) captured on the first inbound message of the conversation and replays it on every event so Meta can attribute the conversion back to the Click-to-WhatsApp ad that drove the chat. Configuration prerequisite on the WhatsApp account metadata: - `metaCapiDatasetId`: the Meta dataset ID linked to the WABA. Provision one with `POST /v1/whatsapp/dataset`. The WABA ID (already set automatically at connect time) is forwarded as `user_data.whatsapp_business_account_id`, which is the per-channel attribution identifier Meta requires for WhatsApp events. No Facebook Page ID is needed (that field is the Messenger-branch identifier). Identify the conversation by either `conversationId` (preferred) or `phoneE164` (digits only, no `+`). At least one is required. If the conversation has no captured `ctwa_clid`, the request returns 422 because there is nothing to attribute. Token and dataset coupling: the WhatsApp account's accessToken must have access to the configured `metaCapiDatasetId`. By default a WABA's system-user token is scoped to the WABA's own Business Manager and cannot post to a pixel owned by a different Business; Meta returns code 100 in that case. Either share the dataset with the WhatsApp app's Business in BM, or use a dataset already in the same Business as the WABA.
3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3293 def send_whats_app_conversion_with_http_info(send_whats_app_conversion_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.send_whats_app_conversion ...' end # verify the required parameter 'send_whats_app_conversion_request' is set if @api_client.config.client_side_validation && send_whats_app_conversion_request.nil? fail ArgumentError, "Missing the required parameter 'send_whats_app_conversion_request' when calling AdsApi.send_whats_app_conversion" end # resource path local_var_path = '/v1/whatsapp/conversions' # 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(send_whats_app_conversion_request) # return_type return_type = opts[:debug_return_type] || 'SendWhatsAppConversion200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.send_whats_app_conversion", :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: AdsApi#send_whats_app_conversion\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad(ad_id, update_ad_request, opts = {}) ⇒ UpdateAd200Response
Update ad
Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform. Per-platform support: - Meta (Facebook + Instagram): all fields supported. - TikTok: status, budget, targeting (via /v2/adgroup/update/), and creative (via /v2/ad/update/ patch-style — headline is ignored, body becomes ad_text). - Pinterest / X / LinkedIn / Google: status + budget only. Sending targeting or creative returns 501 with code unsupported_platform_operation.
3352 3353 3354 3355 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3352 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_account(update_ad_account_request, opts = {}) ⇒ UpdateAdAccount200Response
Update ad account settings
Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to /v1/ads/create, /v1/ads/boost and /v1/ads/ctwa on that ad account can omit dsaBeneficiary/dsaPayor: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use GET /v1/ads/dsa-recommendations to offer suggestions in your UI. If defaultDsaPayor is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with GET /v1/ads/dsa-defaults. Currently supported for Meta accounts only; other platforms return 400.
3425 3426 3427 3428 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3425 def update_ad_account(update_ad_account_request, opts = {}) data, _status_code, _headers = update_ad_account_with_http_info(update_ad_account_request, opts) data end |
#update_ad_account_with_http_info(update_ad_account_request, opts = {}) ⇒ Array<(UpdateAdAccount200Response, Integer, Hash)>
Update ad account settings Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to `/v1/ads/create`, `/v1/ads/boost` and `/v1/ads/ctwa` on that ad account can omit `dsaBeneficiary`/`dsaPayor`: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use `GET /v1/ads/dsa-recommendations` to offer suggestions in your UI. If `defaultDsaPayor` is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with `GET /v1/ads/dsa-defaults`. Currently supported for Meta accounts only; other platforms return 400.
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 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3435 def update_ad_account_with_http_info(update_ad_account_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.update_ad_account ...' end # verify the required parameter 'update_ad_account_request' is set if @api_client.config.client_side_validation && update_ad_account_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_account_request' when calling AdsApi.update_ad_account" end # resource path local_var_path = '/v1/ads/accounts' # 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_account_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdAccount200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.update_ad_account", :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: AdsApi#update_ad_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_status(ad_id, update_ad_status_request, opts = {}) ⇒ UpdateAdStatus200Response
Pause or resume a single ad
Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running). Thin wrapper over the status field of PUT /v1/ads/adId, for callers that want a URL symmetric to /v1/ads/campaigns/campaignId/status and /v1/ads/ad-sets/adSetId/status. {adId} accepts the same identifier dialects as GET/PUT /v1/ads/adId (Zernio hex _id, Meta numeric platformAdId, or the creative's effective story/media IDs). platform is inferred from the ad, so it's not required in the body. Ads in terminal statuses (rejected, completed, cancelled) and no-op flips (already in the target state) are skipped.
3494 3495 3496 3497 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3494 def update_ad_status(ad_id, update_ad_status_request, opts = {}) data, _status_code, _headers = update_ad_status_with_http_info(ad_id, update_ad_status_request, opts) data end |
#update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {}) ⇒ Array<(UpdateAdStatus200Response, Integer, Hash)>
Pause or resume a single ad Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running). Thin wrapper over the `status` field of PUT /v1/ads/adId, for callers that want a URL symmetric to /v1/ads/campaigns/campaignId/status and /v1/ads/ad-sets/adSetId/status. `adId` accepts the same identifier dialects as GET/PUT /v1/ads/adId (Zernio hex `_id`, Meta numeric `platformAdId`, or the creative's effective story/media IDs). `platform` is inferred from the ad, so it's not required in the body. Ads in terminal statuses (rejected, completed, cancelled) and no-op flips (already in the target state) are skipped.
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 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3505 def update_ad_status_with_http_info(ad_id, update_ad_status_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.update_ad_status" end # verify the required parameter 'update_ad_status_request' is set if @api_client.config.client_side_validation && update_ad_status_request.nil? fail ArgumentError, "Missing the required parameter 'update_ad_status_request' when calling AdsApi.update_ad_status" end # resource path local_var_path = '/v1/ads/{adId}/status'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_status_request) # return_type return_type = opts[:debug_return_type] || 'UpdateAdStatus200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.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: AdsApi#update_ad_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_tracking_tags(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ nil
Set ad tracking tags
Unified update. Send only the fields for the ad's platform: - Meta: urlTags (array of key,value). Meta creatives are immutable, so this rebuilds the creative and repoints the ad. By DEFAULT we PRESERVE the existing creative verbatim (re-post its object_story_spec + the new url_tags, reusing the image), so you send urlTags ALONE — no need to read back headline/body/CTA. creative (headline, body, callToAction, linkUrl, imageUrl) is OPTIONAL and only needed to rebuild explicitly, or for SHARE / page-post / dark / asset_feed creatives whose object_story_spec Meta strips (those return 422 asking for creative). - Google: trackingUrlTemplate and/or finalUrlSuffix (full template strings; account quota applies). - LinkedIn: dynamicValueParameters and/or customValueParameters (campaign-level Dynamic UTM).
3568 3569 3570 3571 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3568 def (ad_id, , opts = {}) (ad_id, , opts) nil end |
#update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Set ad tracking tags Unified update. Send only the fields for the ad's platform: - Meta: `urlTags` (array of key,value). Meta creatives are immutable, so this rebuilds the creative and repoints the ad. By DEFAULT we PRESERVE the existing creative verbatim (re-post its object_story_spec + the new url_tags, reusing the image), so you send `urlTags` ALONE — no need to read back headline/body/CTA. `creative` (headline, body, callToAction, linkUrl, imageUrl) is OPTIONAL and only needed to rebuild explicitly, or for SHARE / page-post / dark / asset_feed creatives whose object_story_spec Meta strips (those return 422 asking for `creative`). - Google: `trackingUrlTemplate` and/or `finalUrlSuffix` (full template strings; account quota applies). - LinkedIn: `dynamicValueParameters` and/or `customValueParameters` (campaign-level Dynamic UTM).
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 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3579 def (ad_id, , opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.update_ad_tracking_tags ...' 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 AdsApi.update_ad_tracking_tags" end # verify the required parameter 'update_ad_tracking_tags_request' is set if @api_client.config.client_side_validation && .nil? fail ArgumentError, "Missing the required parameter 'update_ad_tracking_tags_request' when calling AdsApi.update_ad_tracking_tags" end # resource path local_var_path = '/v1/ads/{adId}/tracking-tags'.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() # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.update_ad_tracking_tags", :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: AdsApi#update_ad_tracking_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_ad_with_http_info(ad_id, update_ad_request, opts = {}) ⇒ Array<(UpdateAd200Response, Integer, Hash)>
Update ad Patch one or more fields on an ad. Status, budget, targeting, and creative changes are propagated to the platform. Per-platform support: - Meta (Facebook + Instagram): all fields supported. - TikTok: status, budget, targeting (via `/v2/adgroup/update/`), and creative (via `/v2/ad/update/` patch-style — `headline` is ignored, `body` becomes `ad_text`). - Pinterest / X / LinkedIn / Google: status + budget only. Sending `targeting` or `creative` returns 501 with code `unsupported_platform_operation`.
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 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3363 def update_ad_with_http_info(ad_id, update_ad_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.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 AdsApi.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 AdsApi.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 => :"AdsApi.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: AdsApi#update_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_conversion_destination(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ GetConversionDestination200Response
Update a conversion destination
Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: name, enabled, attribution windows, valueType, value, attributionType. The rule's type and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.
3643 3644 3645 3646 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3643 def update_conversion_destination(account_id, destination_id, update_conversion_destination_request, opts = {}) data, _status_code, _headers = update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts) data end |
#update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts = {}) ⇒ Array<(GetConversionDestination200Response, Integer, Hash)>
Update a conversion destination Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: `name`, `enabled`, attribution windows, `valueType`, `value`, `attributionType`. The rule's `type` and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.
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 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 |
# File 'lib/zernio-sdk/api/ads_api.rb', line 3655 def update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AdsApi.update_conversion_destination ...' 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 AdsApi.update_conversion_destination" end # verify the required parameter 'destination_id' is set if @api_client.config.client_side_validation && destination_id.nil? fail ArgumentError, "Missing the required parameter 'destination_id' when calling AdsApi.update_conversion_destination" end # verify the required parameter 'update_conversion_destination_request' is set if @api_client.config.client_side_validation && update_conversion_destination_request.nil? fail ArgumentError, "Missing the required parameter 'update_conversion_destination_request' when calling AdsApi.update_conversion_destination" end # resource path local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_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_conversion_destination_request) # return_type return_type = opts[:debug_return_type] || 'GetConversionDestination200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"AdsApi.update_conversion_destination", :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: AdsApi#update_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |