Home > Technical & Creative Skills > Tracking Campaigns

How to update Cost by API? (3)


05-21-2016 03:17 PM #1 William Yang (Senior Member)
How to update Cost by API?

Hey Guys

Anyone know how to update cost by API?

I am using Voluum.

really hate to update cost manually.

Thanks!


05-21-2016 04:01 PM #2 ebaskin (Member)

Ok, first of all read the article about Using Voluum Reporting API if you haven't already. Everything you need to do to use the voluum API is explained in there.

I assume you understand how to send HTTP requests etc. so here is what you have to send to update a campaign's cost:

Code:
{"campaignId":"your campaign id","cost":"your new cost","from":"your from date","restoreCost":false,"timeZone":"your time zone","to":"your to date"}
send this data as a POST request to https://reports.voluum.com/manual-costs, make sure to add headers Content-Type: application/json and of course your cwauth-token for authentification


Best,


09-03-2016 10:18 AM #3 sushiparlour (Member)

Hi Ebaskin,

Tried to take your advice on this and set it up but am having <Response [400]> errors. Was wondering if you might have any insights as I haven't been able to get it work and I"ve tried a few things already thanks.


Code:
s = Voluum.login_voluum()

payload = {'campaignId': '60f092e3-242e-4700-b38c-7feda8769839', 'cost': '8.27', 'from': "2016-08-29T13:00:00", 'to' : "2016-09-03T13:00:00", 'restoreCost': 'false', 'timeZone' : "Asia/Shanghai"}
s.headers.update({'Content-Type': 'application/json', 'Content-length' : '171'})

r_url = "https://reports.Voluum.com/manual-costs"
r = s.post(r_url, params=payload)
print(r)
print(r.text)
**s = Voluum.login_voluum() gives me a session with the token inputted already


Home > Technical & Creative Skills > Tracking Campaigns