Seller Central
Seller Forums

Amazon Seller Forums » Login With Amazon » Questions about Login With Amazon

Thread: Unable to get Campaigns by using Advertising API
Thread Archived This thread has been archived - replies are not allowed.


This question is not answered.


Permlink Replies: 1 - Pages: 1 - Last Post: 06 Sep, 2016 11:38 AM by: Brent@Amazon Threads: [ Previous | Next ]
3cpgp

Posts: 1
Registered: 09 Jun, 16 2:07 PM
Posted on: 29 Aug, 2016 5:30 AM  
Click to report abuse...
Hello, I am trying to access campaigns data using Advertising API in C# dot net. I have generated valid access token. I verified the access token by using URL _https://api.amazon.com/auth/O2/tokeninfo?access_token=MY_Access_Code_ it is returning the following response:
{"aud":"My_ClientID","user_id":"My_Account_UserID","iss":"https://www.amazon.com","exp":301,"app_id":"My_AppID","iat":1472469337}
It means that I am using valid access token until 60 minutes. Right?

But when I am going to access Campaign data by using URL
https://advertising-api-test.amazon.com/v1/campaigns I am getting the error (The remote server returned an error: (422) Unprocessable Entity). I have added proper headers to the request call as well. Following is the code through which I am trying to access data:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("https://advertising-api-test.amazon.com/v1/campaigns");

request.Method = "GET";
request.ServicePoint.Expect100Continue = false;
request.ContentType = "application/json";
request.Headers.Add("Authorization", "Bearer Atza|IwEBIIDqhAhKvoPf3NPpievFeYNOujarxkj1N536xgQGXhG57aPJqELFA-X5Iv6hgEufz3TZMDVtDdx4tpqQkR6ORIZKdw_WUEf1PSghTY4693UGnBmwf2ef5Rswt_t4TCdXBeyPWNVmxCjluw5X8edRWeEGIVPlq8IUeKIsMsrITXoh-0KZ_CkscTI9QTrq4EE5naK04dXV5GtvdaQTfCEOTXbLihYZmhLGpnisbZPNALRK9pzWfzRe4OCI-3_fpL7zegHYMIeYAYPK0DGQiyi_FJv3up74B9G6kbvc3bqeTfocVkiCBJcu4SFv3PC4QmnYhAVtiwm1kJ_qng06mehEHgdhwYJURayyprrTDFFGaBGqRD6MJ8XydTBzD6BWPwNY44iW-9_8Ot49rwAQ34vzUCeMp09T1itjLkLHLnpFUww2V7mexI9Q0lNhPHgbL7v9Vc6Y7XiPQFtBlaApBW6vsxPHHjHBqNwo_C1abojLrB6IQx7GtKlzOU1e6ZUFdcvzGPA77bGY8lLklQYPznBSL4dKP6U2gk5TiwCQJr8V2MHq5w");

request.Headers.Add("Amazon-Advertising-API-Scope","cpc_advertising:campaign_management");

HttpWebResponse response = (HttpWebResponse) request.GetResponse(); // Error Point

Please have a look and let me know where change is required.

Thanks

Is this a helpful question? Yes 0   No
1 Reply
Sort replies by:
Brent@Amazon

Posts: 26
Registered: 15 Sep, 14 11:47 PM
Posted on: 06 Sep, 2016 11:38 AM   in response to: 3cpgp in response to: 3cpgp  
Click to report abuse...
Greetings!

I sent you a message regarding this issue. Please have a look and let's discuss.

Thanks!
Was this reply helpful? Yes 0   No 0