Community Discussion

Ask a Question
ANSWERED
ANSWERED
ANSWERED

Java Backstage SDK - Update Campaign Item fails

I'm trying to toggle a campaign item's active status, however it returns with a 400 error: ``` Exception in thread "main" com.taboola.backstage.exceptions.BackstageAPIRequestException: Failed to perform API call with response code [400]. Response payload status [400], message [Unknown field name 'active'], offending field [null], message code [api.action.bad_request.null] at com.taboola.backstage.internal.SynchronousCallAdapterFactory$1.adapt(SynchronousCallAdapterFactory.java:70) at retrofit2.HttpServiceMethod$CallAdapted.adapt(HttpServiceMethod.java:165) at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at com.sun.proxy.$Proxy3.updateItem(Unknown Source) at com.taboola.backstage.services.CampaignItemsServiceImpl.updateItem(CampaignItemsServiceImpl.java:87) ``` My code is pretty simple (vars spoofed)... ``` Backstage backstage = Backstage.builder().build(); String accountName = "account123456"; String campaignId = "123456"; String itemId = "987654321"; CampaignItem item = backstage.campaignItemsService().readItem(clientAuth, accountName, campaignId, itemId); logger.info("ID:{} active:{} status:{} name:{}", item.getId(), item.getActive(), item.getStatus(), item.getTitle()); // Update status to opposite CampaignItemOperation operation = CampaignItemOperation.create().setActive(!item.getActive()); CampaignItem updatedItem = backstage.campaignItemsService().updateItem(clientAuth, accountName, campaignId, itemId, operation); ``` The code fails on the last line, with the above exception. Any ideas what I'm doing wrong? As you can see, I'm able to retrieve the Campaign Item just not update its active value.
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Χ