Below is my payload, the name is Arabic when I send it with HTTP client I'm getting unauthorized. When the name is in English, same body work fine. Why? Can somebody tell me how to solve it.
{"groupId":"
0000000000000
","entityType":"ORGANISATION","caseId":"ORG-00000800","providerTypes":["CLIENT_WATCHLIST","WATCHLIST"],"caseScreeningState":{"WATCHLIST":"ONGOING"},"name":"الشركة تكون","nameTransposition":
false
,"secondaryFields":[{"typeId":"SFCT_6","value":"BEL"}],"customFields":[]}
Code.
public string WorldCheckPostData(string data, string firstPart, string firstValue = null, string secondPart = null, string secondValue = null)
{
HttpResponseMessage response = null;
string urlSecondPart = CreateNewString(firstPart, firstValue, secondPart, secondValue);
Uri uri = new Uri($"{_baseUrl}{urlSecondPart}");
try
{
using (var client = new HttpClient())
{
HttpMethod httpMethod = HttpMethod.Post;
Encoding encoding = Encoding.UTF8;
HttpRequestMessage httpRequest = GenerateHTTPRequest(uri, httpMethod, data);
//httpRequest.Content = new StringContent(data, encoding, _contentType);
httpRequest.Content = new StringContent(data, encoding, _contentType);
httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(_contentType);
response = client.SendAsync(httpRequest).GetAwaiter().GetResult();
if (!response.IsSuccessStatusCode)
{
var message = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
throw new Exception($"World Check POST method field with exception: { message }");
}
httpRequest.Dispose();
}
}
catch (Exception)
{
throw;
}
return response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
}