Community Discussion

Ask a Question
Back to All

Why am I getting a 400 when trying to update the publisher targeting?

This is the function:

def update_exclusions(campaign_id):  
    payload = get_sites_to_block(campaign_id)  
    print(payload)  
    url = f'<https://backstage.taboola.com/backstage/api/1.0/lubamediaeursl-22-sc/campaigns/{campaign_id}'>  
    print(url)  
    response = requests.post(url, headers=headers, json=payload)  
    response.raise_for_status()  
    print(response.text)  
    return response.status_code

This is the payload:

{"publisher_targeting": {"type": "EXCLUDE", "value": ["tollywood-english", "informalnewz", "dailynewskannada-viralarticlesherecom", "talkaaj-publisher", "whiteplanettechnologies-essaybanyan", "timebucks-timecave", "pinkvilla-network", "hindikiduniya", "onevisiontechnologies-cinejosh", "lemaleadmachine-tipsandtricks", "keralakaumudi-keralakaumudi", "addatoday", "izonweb-businessleague", "govnokri", "iploc-elgoog", "izonweb-rightsofemployees", "crowdyfan", "academynewspaper-mysurumithra", "vivo-browser-chrome-english", "kashmirlife", "vitaminnews", "vivo-browser-sc-india-english", "greaterkashmircom", "tamilspark", "xfreehub", "cinereporters", "gadgetheory-mobilet", "studentsea", "vivo-browser-sc-india-gujarati", "vivo-browser-sc-india-tamil", "valappottukal", "healthynews-tv", "learnitwise", "pinoydesigns-ulrichome", "nalandalive", "lankasri-viduppu", "sunmixnetwork-cineulagam", "sunmixnetwork-ibctamil", "excusemeodisha-excusemeodisha", "nationalherald-english", "storytohearhu-p19553600", "jobsbazzar-vivasaayathaikappom", "eurasiantimes", "albvisioninternational-insidedogsworld", "momagic-retailpn", "entertainmentportal", "mods4you", "lankasri-ibctamilnadu", "housejogger", "newsaromamedia", "odiapost-enews23", "prabodhanprakshan-saamana", "fpj-amp", "odishatv-khabarodishatv", "tastyrecipesnew-jobsatqatar", "tastyrecipesnew-upstudent", "tastyrecipesnew-jobatcanada", "tastyrecipesnew-omanjobvacancy", "jobsbazzar-viewkhabar", "odishabhaskar", "prabhasakshi-prabhasakshi", "unidadeditorial-marcaenglish", "sexpacket-trendigt", "messagecube-supereasygame", "ptcnetwork-ptcnews", "foodhealth-astrologyviral", "krishijagran-odia", "zeemedia-dnaindiahindi", "firstnaukris", "indiagovtexam", "kolkata24x7india", "hellomaharastra", "ellomaharastra-hellokrushi", "ekanktechnologies-samhita", "etvbharat-etvbharathindibihar", "etvbharat-etvbharathindiuttar-pradesh", "etvbharat-etvbharathindiuttarakhand", "etvbharat-etvbharatkannadakarnataka", "etvbharat-etvbharatenglishnational", "etvbharat-etvbharathindiharyana", "etvbharat-etvbharattamiltamil-nadu", "worldfamilys", "banglahunt-bongtrend", "thetribuneindia-tribuneindia", "sattarani-publisher", "tastyrecipesnew-cookingvideos", "dainikbharat24-publisher", "prabhatkhabarindia-prabhatkhabar", "upuklive-loveindianational", "gujaratsamacharindia-gujaratsamacharweb", "gadgetsupdateshindi", "jagrannewmedia-gujaratijagran", "network18media-news18tamil", "network18media-news18telugu", "network18media-news18bengali", "network18media-cnbc-tv18english", "tastyrecipesnew-footballwing", "tastyrecipesnew-movieshows", "technewswebs", "lalluram", "thetelugunews-publisher", "siddhmaniconsultants-samarcharjagat", "rozanaspokesman-publisher", "ndtv-tools", "backtobollywood-publisher", "hellobdnewz-publisher", "lfimedia-goodtoknowthist", "gadgetsupdateshindi-bharatyojanaorg", "stepsetgoindia-sdk-android", "ecovahan-publisher", "mediamangalam-publisher", "infokhabars-publisher", "vtv-gujarati", "allindiasamachar2021-thekarnatakanews", "karimizhi-thani-nadanin", "royalbulletin-publisher", "fantoo-android", "indianspost-publisher", "tamizhanmedia", "divyahimachal-publisher", "ntvtelugu-publisher", "vikatandigital-vikatancom", "kajersubidha-publisher", "sarkarihelp-publisher", "updatenews360-publisher", "tv9-hindi", "tv9-telugu", "ecovahan-vyaparkaro", "kannadanewstoday-publisher", "tastyrecipesnew-cricketindnews", "sstvkannada-publisher", "ndtv-mp", "primereel-publisher", "t2blive-publisher", "hosakannada-hosavishya", "shethepeopleindia-hindi", "tnstudycorner-publisher"]}}

This is the response:

400 Client Error: Bad Request for url: https://backstage.taboola.com/backstage/api/1.0/lubamediaeursl-22-sc/campaigns/27990851