RestClient Error: 400 Bad Request

Last Reply 14 days ago By PrinceG

Posted 14 days ago

Hi Sir!

I am ending up with 400 Bad Request. Is this piece of code will be fine to cover the parameters I mentioned above in Question. 

client_id, client_secret, Type: OAuth2, client authentications 'Send as Auth header' and access token url.

var client = new RestClient("");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "grant_type=client_credentials&client_id=client_id&client_secret=client_secret", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

I haven't had experinece in this API calls.:(

You are viewing reply posted by: PrinceG 14 days ago.