Using Postman I succeeded invoking this api described here https://anypoint.mulesoft.com/exchange/portals/nz-post-group/b8271f09-2ad8-4e1c-b6b1-322c5727d148/nzpost.addresschecker/minor/1.0/pages/Suggest%20Addresses/
but I'm struggling achieving the same with C#.
tried this but didn't work. is this missing any extra header?:
public static async Task<HttpResponseMessage> GetToken()
{
var data = new
{
client_id = "xxxxxxxxxxxxxxxxxxxxxxxxx",
client_secret = "xxxxxxxxxxxxxxxxxxxxxx",
grant_type = "client_credentials"
};
var json = JsonConvert.SerializeObject(data);
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.PostAsync("https://oauth.xxxx.co.nz/as/token.oauth2", stringContent);
return response;
}