Coder Social home page Coder Social logo

Comments (10)

MSDP avatar MSDP commented on July 23, 2024

When converting the request/response functions in HelloSignService to non-async I was able to get debug information out of it.

  •   $exception  {"The remote server returned an error: (400) Bad Request."} System.Exception {System.Net.WebException}
    
    
        var requestSignature = new SignatureRequestSendRequest
        {
            Title = "Test",
            Subject = "Subject",
            Message = "Wweeeeeeee",
            TestMode = 1,
            Signers = new List<SignerRequest>
            {
                new SignerRequest
                {
                    EmailAddress = "[email protected]",
                    Name = "Foo Man Choo",
                    Order = 0
                }
            },
            Files = new List<string> { @"C:\Users\adam_000\Documents\[SBS]_Release_and_Authorization_Form.pdf" }
        };
    
        try
        {
            var signatureResponse = await helloSign.SignatureRequest.CreateEmbeddedAsync(requestSignature);
            var signatureUrlResponse =
                await helloSign.Embedded.GetSignUrlAsync(signatureResponse.First().Signatures.First().SignatureId);
    
            return signatureUrlResponse;
        }
    

from hellosign.net.

jdconley avatar jdconley commented on July 23, 2024

What does the calling code method signature look like? Is the method an "async void" or "async Task"? If the former, it might exit your application, whereas the latter would throw a WebException with the 400 error.

https://msdn.microsoft.com/en-us/magazine/jj991977.aspx

from hellosign.net.

MSDP avatar MSDP commented on July 23, 2024

Task.

    public static async Task<Embedded> RequestSignature()
    {
        var helloSign = new HelloSignClient("##KEY##");
        var requestSignature = new SignatureRequestSendRequest
        {
            Title = "Test",
            Subject = "Subject",
            Message = "Wweeeeeeee",
            TestMode = 1,
            Signers = new List<SignerRequest>
            {
                new SignerRequest
                {
                    EmailAddress = "jacob@***EMAIL***",
                    Name = "Foo Man Choo",
                    Order = 0
                }
            },
            Files = new List<string> { @"C:\Users\adam_000\Documents\[SBS]_Release_and_Authorization_Form.pdf" }
        };

        try
        {
            var signatureResponse = await helloSign.SignatureRequest.CreateEmbeddedAsync(requestSignature);
            var signatureUrlResponse =
                await helloSign.Embedded.GetSignUrlAsync(signatureResponse.First().Signatures.First().SignatureId);


            return signatureUrlResponse;
        }
        catch (Exception ex)
        {

        }
        return null;
    }

from hellosign.net.

jdconley avatar jdconley commented on July 23, 2024

Cool, and I assume down the call stack this is the same?

from hellosign.net.

MSDP avatar MSDP commented on July 23, 2024

Calling Start:

    static void Main()
    {

        var requestSignature = RapidSignService.RequestSignature();
    }

Which is into the previously posted code.

from hellosign.net.

jdconley avatar jdconley commented on July 23, 2024

requestSignature in Main is a Task object. You'll need to .Wait() until it completes in Main, which will throw the exception.

from hellosign.net.

MSDP avatar MSDP commented on July 23, 2024

There we go, thank you.

Error: The remote server returned an error: (400) Bad Request. @ HelloSignService.cs - 106:: using (WebResponse response = await webReq.GetResponseAsync())

data = "test_mode=1&file[0]=C%3a%5cUsers%5cadam_000%5cDocuments%5c%5bSBS%5d_Release_and_Authorization_Form.pdf&title=Test&subject=Subject&message=Wweeeeeeee&signers[0][name]=Foo+Man+Choo&signers[0][email_address]=jacob%40ms-dp.net&signers[0][order]=0"

url = "https://api.hellosign.com/v3/signature_request/create_embedded"

endpoint = "/signature_request/create_embedded"

from hellosign.net.

MSDP avatar MSDP commented on July 23, 2024

Adam,

Looks like we're receiving the 'file' parameter in the wrong format. The request needs to have Content-Type:multipart/form-data, as when using "curl -F ...". In your case, it looks like the 'file' parameter isn't coming in that way.

Hope this helps,

Stephen Eisenhauer
Software Engineer
HelloSign

from hellosign.net.

jdconley avatar jdconley commented on July 23, 2024

I see. It looks like the API to upload a file as part of the embedded request hasn't been implemented. That would have to be added to the library. We use this in conjunction with existing templates that have been uploaded through the HelloSign UI.

from hellosign.net.

MSDP avatar MSDP commented on July 23, 2024

Oh I would prefer to use it that way. I'll try it out!
On Feb 2, 2015 8:33 PM, "JD Conley" [email protected] wrote:

I see. It looks like the API to upload a file as part of the embedded
request hasn't been implemented. That would have to be added to the
library. We use this in conjunction with existing templates that have been
uploaded through the HelloSign UI.


Reply to this email directly or view it on GitHub
#10 (comment)
.

from hellosign.net.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.