Here is WebAPI EndPoint: https://mysoylplus-apptest.frontierag.co.uk/api/someendpoint
i am sending formData in postman in key value pair like below: authenticationData[b64EncryptedSoylSenseInfo] : 'somekey', authenticationData[b64iv] : 'some key' the above data is in key value pair.
the above thing is working in postman but when i use HTTPclient in c# code. this is giving me 401 exception.
What am i doing wrong , using postman i am getting 200 ok, but using below i am geting 401. Please help
string url = "https://mysoylplus-apptest.frontierag.co.uk/api/someendpoint";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Accept", "application/x-www-form-urlencoded");
using (var httpContent = new HttpRequestMessage(HttpMethod.Post, url))
{
client.Timeout = TimeSpan.FromMinutes(20);
var values = new Dictionary<string, string>();
values.Add("authenticationData[b64EncryptedSoylSenseInfo]", "somekey");
values.Add("authenticationData[b64iv]", "somekey");
httpContent.Content = new FormUrlEncodedContent(values);
var response = client.PostAsync(url, httpContent.Content);
// here is the hash as string
var result = response.Result.ToString();
}
}
Aucun commentaire:
Enregistrer un commentaire