rajiv-nagpures… | Posts: 36

Assistance with REST api code to Authenticate Signers

0 votes
I am following the example in your blog to Authenticate a Signer: https://www.esignlive.com/blog/esignlive-how-to-authenticating-signers/ Here is what I have produced: var apiKey = CeremonyClient.GetKey(); var urlBase = CeremonyClient.GetUrl(); // "https://sandbox.e-signlive.com/api" var json = authList.Aggregate("{\"auth\":{\"challenges\":[", (current, t) => current + ("{\"question\":" + t.Question + ",\"answer\":" + t.Answer + "},")); json += "],\"scheme\":\"CHALLENGE\"}"; var jsonContent = new StringContent(json, Encoding.UTF8, "application/json"); var form = new MultipartFormDataContent(); form.Add(jsonContent, "\"payload\""); HttpClient myClient = new HttpClient(); myClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", apiKey); myClient.DefaultRequestHeaders.Add("Accept", "application/json"); var response = await myClient.PostAsync(new Uri(urlBase) + "/packages/", form); var responseBody = await response.Content.ReadAsStringAsync(); return responseBody; What I am not clear on is the uri for the Post statement. Can you clarify for me ?

harishaidary | Posts: 1812

Reply to: Assistance with REST api code to Authenticate Signers

0 votes
Hey Rajiv,
var response = await myClient.PostAsync(new Uri(urlBase) + “/packages/”, form);
The line above makes a POST request to the specified Uri (i.e. https://sandbox.esignlive.com/api/packages/") with an HttpContent (i.e. "form"). More info on this here: https://msdn.microsoft.com/en-us/library/hh138190(v=vs.118).aspx If you would like to know what an uri is, then you could have a look at this post on stackoverflow: http://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn

rajiv-nagpures… | Posts: 36

Reply to: Assistance with REST api code to Authenticate Signers

0 votes
thank you Haris! Therefore, does it mean that the correct value for the uri is https://sandbox.esignlive.com/api/packages/ ? Also, is the auth object with challenges the only required data for the form data?

rajiv-nagpures… | Posts: 36

Reply to: Assistance with REST api code to Authenticate Signers

0 votes
Client already has the createandsendpackage REST API example working, he is trying to use the REST API to sign a document. He has already created a package and has access to signer’s url and wants to create a rest api call to sign the document. Can you please share the code snippet for it?

harishaidary | Posts: 1812

Reply to: Assistance with REST api code to Authenticate Signers

0 votes
Hey Rajiv, I will look this up for you. I'll post back an answer here :)

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off