API ReferenceAnnouncementsCommunity Discussion
API ReferenceCommunity DiscussionAnnouncementsLog In
Community Discussion

Community Discussion

Ask a Question
Back to All

400 Error for activity_schedule

I quite literally enter it as it is in the documentation:

"activity_schedule": {
"mode": "CUSTOM",
"rules": [
{
"type": "INCLUDE",
"day": "MONDAY",
"from_hour": "10",
"until_hour": "18"
},
{
"type": "EXCLUDE",
"day": "SATURDAY",
"from_hour": "0",
"until_hour": "24"
},
{
"type": "EXCLUDE",
"day": "SUNDAY",
"from_hour": "10",
"until_hour": "22"
},
],
"time_zone": "US/Eastern"
},

And I get:

Taboola Error: {"http_status":400,"message":"Bad request","message_code":"api.action.bad_request.null"}

How can this be?

Hi Steve,

Can you please provide the entire endpoint you are sending with this activity schedule?

Best,

Stephen

{
"name": "SteveTestCampaign_IT_IT_D",
"branding_text": "Trendscatchers",
"cpc": 0.0150,
"daily_cap": 10,
"tracking_code": "utm_source=tab-{campaign_id}&utm_medium={site_id}&utm_term=taboola&utm_campaign={campaign_name}",
"spending_limit": 10000000,
"spending_limit_model": "MONTHLY",
"marketing_objective": "LEADS_GENERATION",
"country_targeting": {
"type" : "INCLUDE",
"value" : ["IT","CH","AT"]
},
"platform_targeting": {
"type" : "INCLUDE",
"value" : ["DESK"]
},
"start_date": "2023-03-07",
"activity_schedule": {
"mode": "CUSTOM",
"rules": [
{
"type": "INCLUDE",
"day": "MONDAY",
"from_hour": "10",
"until_hour": "18"
},
{
"type": "EXCLUDE",
"day": "SATURDAY",
"from_hour": "0",
"until_hour": "24"
},
{
"type": "EXCLUDE",
"day": "SUNDAY",
"from_hour": "10",
"until_hour": "22"
},
],
"time_zone": "US/Eastern"
},
"bid_type": "FIXED"
}

Hello Stephen,

Here is the endpoint sent to Taboola.

Kind regards

Steve

Hi Steve,

Can you provide the entire endpoint you are calling? For example, https://backstage.taboola.com/backstage/api/1.0/{account_id}/campaigns/{campaign_id}

Thanks,

Stephen

Hello Stephen,

So it would be this one:

"https://backstage.taboola.com/backstage/api/1.0/" . $account . "/campaigns/"

Kind regards

Steve

Can you provide the account and campaign ID you are using? If you'd prefer, you can copy the details into a private Google Doc and post a link here. Once we have the link, we will send you a request for access.

Hello Stephen

There is no Campaign Id as I am creating a new one using this endpoint:

https://developers.taboola.com/backstage-api/reference/create-a-campaign

So Taboola is assigning a new ID each time, and no Campaign ID is used in the API call. We have over 100 accounts but an example of one I tried is:

"trendscatchers-healthcatchersfr-sc"

Kind regards

Steve

Hey Steve,

I am not seeing anything wrong with your call on my end. I ran it as a test and at first I encountered a similar 400 reply after directly copy and pasting your request body. After formatting it properly as a JSON object, it actually ran successfully and created the campaign. I paused the campaign for now. If you are still encountering the 400 error, you may want to try to format the body properly as a JSON object

Here is the full call:

curl --location --request POST 'https://backstage.taboola.com/backstage/api/1.0/trendscatchers-healthcatchersfr-sc/campaigns/'
--header 'Authorization: Bearer CYAXAAAAAAAAEVFaAwAAAAAAGAEgACkTYN3BhgEAADooNTZlYzc0Y2NiNDhhODFjYzRhZGVjNDA0MDExNzhiOTQ3ODllMzcyYUAC::9af47a::21bdef'
--header 'Content-Type: application/json'
--data-raw '{
"name": "SteveTestCampaign_IT_IT_D",
"branding_text": "Trendscatchers",
"cpc": 0.015,
"daily_cap": 10,
"tracking_code": "utm_source=tab-{campaign_id}&utm_medium={site_id}&utm_term=taboola&utm_campaign={campaign_name}",
"spending_limit": 10000000,
"spending_limit_model": "MONTHLY",
"marketing_objective": "LEADS_GENERATION",
"country_targeting": {
"type": "INCLUDE",
"value": ["IT", "CH", "AT"]
},
"platform_targeting": {
"type": "INCLUDE",
"value": ["DESK"]
},
"start_date": "2023-03-08",
"activity_schedule": {
"mode": "CUSTOM",
"rules": [
{
"type": "INCLUDE",
"day": "MONDAY",
"from_hour": "10",
"until_hour": "18"
},
{
"type": "EXCLUDE",
"day": "SATURDAY",
"from_hour": "0",
"until_hour": "24"
},
{
"type": "EXCLUDE",
"day": "SUNDAY",
"from_hour": "10",
"until_hour": "22"
}
],
"time_zone": "US/Eastern"
},
"bid_type": "FIXED"
}
'

Hope this helps.

Best,

Stephen

Marked as answered by Stephen Russo

Hi Stephen,

It does indeed seem good now, thank you very much!

Kind regards

Steve

ο»Ώ