Community Discussion

Ask a Question
ANSWERED

Issues connecting to API for new environment

Greetings, We've worked with the backstage API a bit before, but for a new project, we had a sandbox environment set up for testing purposes. We are having difficulty getting our API call to work, and the errors that are returning are not at all helpful. I really wish the API responded with more information to help troubleshoot. If we use the numerical account ID provide by our account manager we get the following error: {http_status: 403, message: "Requested action is forbiddenโ€} If we use the alpha string ID ie. "Your Account Sandbox Name" with letters and spaces we get the following error: "Bad Request" Our payload follows the JSON structure outlined here: https://developers.taboola.com/backstage-api/reference#creating-a-batch-of-campaign-items That is the method we are calling from our application, which submits the JSON object via an AJAX post. Here is a section of our code to show what we are doing: $url = 'https://backstage.taboola.com/backstage/oauth/token'; $data = array('client_id' => $taboolaCID, 'client_secret' => $taboolaSecret, 'grant_type' => 'client_credentials'); $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); $taboolaAccessToken = json_decode($result)->{'access_token'}; $ch = curl_init('https://backstage.taboola.com/backstage/api/1.0/'.$taboolaAccount.'/campaigns/'.$campaign_id.'/items/mass' ); $payload = json_encode($collection, JSON_UNESCAPED_SLASHES); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, โ€˜Our Application Name'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload ); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'cache-control: no-cache', 'Authorization: Bearer ' . $taboolaAccessToken )); $data = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); Any assistance would be greatly appreciated. Thanks!
ANSWERED
ANSWERED
150030003014004014034044294_flows50050390_daysaccess_tokenaccountaccount_creationaccount_idaccount_levelaccount_level_blockaccount_typeaccountsactivity_scheduleactual_cpcadvertiser_idadvertisersallowed_accountsalphabeticapi_accessapi_changesapi_keyapi_newsletterapi_secretaudienceaudience_onboardingaudience_segmentsaudience_targetingaudiencesaudit_trailauthorization_codeauto_targetingaws_downtimeaws_serverbalancebasebasic_authenticationbibidbid_modifierbid_modifiersbillingbilling_cycleblockblock_publisherblock_publishersbrand_safetybrowser_breakdownbulk_createbulk_updatebulk_update_campaignsby_audienceby_campaignby_hour_of_daycachingcampaigncampaign_daycampaign_day_breakdowncampaign_fieldscampaign_learningcampaign_levelcampaign_ownercampaign_site_daycampaign_summarycampaignscity_targetingclick_idclicksclient_credentialscode_snippetconnectorcontent-typeconversion_dataconversion_ruleconversionsconversions_valuecorscountriescountrycountry_codescpa_actionscpa_actions_numcpccpc_macrocreate_campaigncreate_itemcreate_timecreation_datecustom_audiencecustom_audience_rulecustom_conversion_rulecustom_conversionscut_offdaily_capdaily_spenddata_freshnessdata_studiodata_studio_connectordayday_dimensiondelaydeletedictionarydifferent_accountdiscrepancydocs_issuedocumentationdomainduplicateduplicate_campaignempty_responseend_dateevent_basedexelatefeature_requestfetch_levelfiltersfirst_party_audienceflowfull_authenticationget_account_detailsgoogle_apps_scriptgoogle_scriptgoogle_sheetshidden_audiencehidden_segmentshourlyhourly_reportinghourly_spendhtmlhtml_login_pagehtml_responseiasimplicit_flowinactive_accountsinclude_multi_conversionsinclusionsintegrationinternal_support_ticketip_addressis_atomicitemitemsixudra_curljava_client_sdkjava_sdkjavascriptjsjupyter_notebooklaravellearning_statelimitlist_of_publisherslookalike_audiencelookalike_audienceslookback_windowloss_of_scalemacrosmalformed_jsonmarketplacemarketplace_audiencesmax_campaignsmax_itemsmax_resultsminimum_bidminimum_cpcmixedanalyticsmy_audiencesnetworknetwork_accountnew_featurenullnumeric_site_idoauth2os_breakdownpage_viewpagingpartner_typepassword_credentialspatchpausepermissionsphppixel_lookalikeplacementplacement_breakdownplacement_filterplacement_nameplatform_targetingpostmanprecannedprerequisites_not_metpublisherpublisher_bid_modifierpublisher_blockspublisher_idpublisher_namepublisher_networkpublisher_reportspublisher_targetingpublisher_urlpublisherspythonpython_clientrrate_limitreal_timereal_time_reportingrecommendation_apiredirect_urirejected_campaignsremove_allreport_cachingreportingreporting_discrepancyreportsretention_periodrevenuerevenue_summaryrevenue_summary_reportroadmaps2ssafety_ratingsalessandboxscalesitesite_breakdownsite_nameslowslownesssort_filterspecial_charsspendspending_limitsslssostatussub_accountssupermetricssupport_tickettataboola_adstaboola_pixeltargetingtcctest_accounttheoptimizertimeouttimezonetlstop_campaign_contenttop_contenttracking_codetypouiunblock_publishersunknown_publisherupdate_itemupload_imageurluser_accountsuser_segmentsutmvaluevideovideo_campaign_summaryvideo_campaignsvideo_completionsvideo_itemvideo_itemsviewsvisit_valuevoluumweb_hookswhitelistx-www-form-urlencodedyearly_reportingื