For a deeper look into our World Check One API, look into:

Overview |  Quickstart |  Documentation |  Downloads

question

Upvotes
1 3 3 2

Am trying to post request to WC1 API but i get an error The remote server returned an error: (404) when i try to check the Response HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();, i already have an api key and api secret

world-checkworld-check-onec#
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
4.5k 4 8 8

@m.arar,

Thank you for your query.

Could you please let us know the endpoint for which you are receiving the error? Also please provide us the request and response headers of the failed API call masking the credentials and the hmac signature.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

i have answered your query below

Upvotes
1 3 3 2

requestendpoint = "https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases";

post Data:

string postData = "{\"secondaryFields\":[],\"entityType\":\"INDIVIDUAL\",\"customFields\":[],\"groupId\":\"418f28a7-b9c9-4ae4-8530-819c61b1ca6c\",\"providerTypes\":[\"WATCHLIST\"],\"name\":\"乔治布什\"}";

my Request:

HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(requestendpoint);

// Set the Headers

WebReq.Method = "POST";

WebReq.Headers.Add("Authorization", authorisation);

WebReq.Headers.Add("Cache-Control", "no-cache");

WebReq.ContentLength = msg.Length;

WebReq.Date = dateValue; // use datetime value GMT time

// Set the content type of the data being posted.

WebReq.ContentType = "application/json";

WebReq.ContentLength = byte1.Length;

do you want me to provide you with My api and api Secret ?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
4.5k 4 8 8

@m.arar,

Thank you for the details.

Can you please check if the group-id which you are using is the correct one? Please use the below endpoint to fetch the group id.

https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/groups

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 3 3 2

Sorry it was my mistake that i haven't write the exact group id
i have change it to the correct one, but now i am getting new error at get GetResponse()

'The remote server returned an error: (401) .'

Thank you for your support


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
4.5k 4 8 8

@m.arar,

Please share the request and the response headers of the failed request along with the request body, so we may investigate on the same.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 3 3 2

string postData = "{\"secondaryFields\":[],\"entityType\":\"INDIVIDUAL\",\"customFields\":[],\"groupId\":\"e0eb258d-d67d-4843-a592-7e973de6aa85\",\"providerTypes\":[\"WATCHLIST\"],\"name\":\"WASATA\"}";


string msg = postData;

//Console.WriteLine(msg);

UTF8Encoding encoding = new UTF8Encoding();

byte[] byte1 = encoding.GetBytes(postData);


string dataToSign = "(request-target): post " + gatewayurl + "cases\n" +

"host: " + gatewayhost + "\n" + // no https only the host name

"date: " + date + "\n" + // GMT date as a string

"content-type: " + "application/json" + "\n" +

"content-length: " + byte1.Length + "\n" +

msg;


string authorisation = "Signature keyId=\"" + apikey + "\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date content-type content-length\",signature=\"" + hmac + "\"";


HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(requestendpoint);


WebReq.Method = "POST";

WebReq.Headers.Add("Authorization", authorisation);

WebReq.Headers.Add("Cache-Control", "no-cache");

WebReq.ContentLength = msg.Length;

WebReq.Date = dateValue;


WebReq.ContentType = "application/json";

WebReq.ContentLength = byte1.Length;


Stream newStream = WebReq.GetRequestStream();

newStream.Write(byte1, 0, byte1.Length);


// Get the Response - Status OK

HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();

// Status information about the request

Console.WriteLine(WebResp.StatusCode);

Console.WriteLine(WebResp.ResponseUri);


Stream Answer = WebResp.GetResponseStream();

StreamReader _Answer = new StreamReader(Answer);

string jsontxt = _Answer.ReadToEnd();



This is my full request

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@m.arar,

Can you please share the request and the response headers along with the body? The above looks like code snippet from the application.


request endpoint: "https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/groups";


postRequestData: "{\"secondaryFields\":[],\"entityType\":\"INDIVIDUAL\",\"customFields\":[],\"groupId\":\"e0eb258d-d67d-4843-a592-7e973de6aa85\",\"providerTypes\":[\"WATCHLIST\"],\"name\":\"WASATA\"}";




WebReq.Method = "POST";

WebReq.Headers.Add("Authorization", Signature keyId="43c4a334-ce22-4ab8-8658-fd816de77f60",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="O0U5Jx5QUlXvCgpmspm9n74uUQYbQ20BcFc1lHeOALA=");

WebReq.Headers.Add("Cache-Control", "no-cache");

WebReq.ContentLength = 161;

WebReq.Date = 7/29/2020 9:11:15 AM

WebReq.ContentType = "application/json";

WebReq.ContentLength =161;

Is this info are clear or you want me to share more info about the request

thank you for your support

@m.arar,

These are the request headers and the body. We would also need the response headers of the same request.

Authorization: WWW-Authenticate: Signature realm="World-Check One API",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length"

i have found this in the world check one api documentation as an response header
the code the i have showed you before i have download it from world check one Api, but in the code i don't see where is the response header are called

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.