Store/Update Facebook AdCosts

This API request stores and updates Facebook ad cost data for a specific site using the HTTP method PUT. The request includes the following parameters:

Path Parameters:

SiteIdstringRequired

The ID of the site for which to add or update ad cost data

Headers:

AuthorizationstringRequired

The authorization token for accessing the API. The header value should be set to "Bearer {your-access-token}", where {your-access-token} is the access token assigned to the user.

Request Body(JSON payload):

The data containing the ad cost information to store or update. The payload should include the following parameters:

account_currencystringRequired

The currency used for the ad account.

campaign_idstringRequired

The ID of the campaign for the ad.

campaign_namestringRequired

The name of the campaign for the ad.

adset_idstringRequired

The ID of the ad set for the ad.

adset_namestringRequired

The name of the ad set for the ad.

ad_idstringRequired

The ID of the ad.

ad_namestringRequired

The name of the ad.

clicksstringRequired

The number of clicks generated by the ad.

ctrstring

The click-through rate of the ad.

spendstringRequired

The amount spent on the ad.

cpcstring

The cost per click of the ad.

impressionsstringRequired

The number of times the ad was shown.

conversionsarray

The conversions generated by the ad.

cost_per_conversionfloat

The cost per conversion of the ad.

reachintRequired

The number of unique people who saw the ad.

date_startstringRequired

The start date of the ad campaign, must be in ISO 8601 format. yyyy-dd-mm

date_stopstringRequired

The end date of the ad campaign, must be in ISO 8601 format. yyyy-dd-mm

publisher_platformstringRequired

The platform where the ad was published.


The {siteId} parameter in the URL endpoint should be replaced with the appropriate ID for the site being updated, and the {your-access-token} parameter in the authorization header should be replaced with the appropriate access token.

Request
PUT
{siteId}/adcosts/facebook
curl -X PUT \ 'https://rest.rulerapi.com/v1/{siteId}/adcosts/facebook' \ -H 'Authorization: Bearer {your-access-token}' \ -H 'Content-Type: application/json' \ -d '{ "account_currency": "{account_currency}", "campaign_id": "{campaign_id}", "campaign_name": "{campaign_name}", "adset_id": "{adset_id}", "adset_name": "{adset_name}", "ad_id": "{ad_id}", "ad_name": "{ad_name}", "clicks": "{clicks}", "ctr": "{ctr}", "spend": "{spend}", "cpc": "{cpc}", "impressions": "{impressions}", "conversions": "{ onversions}", "cost_per_conversion": "{cost_per_conversion}", "reach": "{reach}", "date_start": "{date_start}", "date_stop": "{date_stop}", "publisher_platform": "{publisher_platform}" }'
Response
Status: 201