hellosign / hellosign-dotnet-sdk

A .NET SDK for the HelloSign API
MIT License
26 stars 29 forks source link

Implement template/update_files/ #44

Open alexmac05 opened 7 years ago

alexmac05 commented 7 years ago

Please implement the POST https://[api key]:@api.hellosign.com/v3/template/update_files/[:template_id]

alexmac05 commented 5 years ago

POST https://[api key]:@api.hellosign.com/v3/template/update_files/[:template_id]

Internal reference number 368984 Requested by customer on 2-18-19

alexmac05 commented 5 years ago

workaround using the restsharp request library

try { var hslogin = "HelloSign account here"; var hspassword = "password"; var apiKey = "API KEY HERE";

var restClient = new RestClient();

string buildTheRequest = "https://" + apiKey + ":@api.hellosign.com"; Console.WriteLine(buildTheRequest);

restClient.BaseUrl = new Uri(buildTheRequest); restClient.Authenticator = new HttpBasicAuthenticator(hslogin, hspassword);

var request = new RestRequest(); request.Resource = "v3//template/update_files/TEMPLATE ID HERE";

request.Method = Method.POST; //request.AddFile("nda.pdf", @"C:\Users\Me\My Documents\NDA.pdf"); request.AddFile("nda.pdf", @"/Users/example/nda.pdf"); request.AddParameter("test_mode", 1);

IRestResponse response = restClient.Execute(request);

Console.WriteLine(response.Content);

if (response.ErrorException != null) { const string message = "Error retrieving response. Check inner details for more info."; var helloSignException = new ApplicationException(message, response.ErrorException); throw helloSignException; } } catch (Exception ex) { Console.WriteLine(ex.Message, ex.InnerException.Message); }

}