docusign / docusign-esign-csharp-client

The Official Docusign C# Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://developers.docusign.com/docs/esign-rest-api/sdks/csharp/
MIT License
129 stars 159 forks source link

Null properties in CreateTemplate response #246

Open ShawnCholeva opened 4 years ago

ShawnCholeva commented 4 years ago

Hey, I noticed when trying to create a template using the DocuSign.eSign.dll 4.1.1 nuget package that all of the properties on the TemplateSummary response are null like so:

image

I hit the rest endpoint, https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/templates, in docusign via Postman doing a POST request and got back the following response:

{
    "templates": [
        {
            "templateId": "1eb5637f-a553-486f-88ce-c62f184709d7",
            "uri": "/templates/1eb5637f-a553-486f-88ce-c62f184709d7"
        }
    ]
}

I believe that the TemplateSummary properties aren't mapping correctly from the response, do we think this could be true?

LarryKlugerDS commented 4 years ago

Hi @ShawnCholeva ,

Thank you for the bug report. I've investigated it, and I believe that the problem is that the Swagger file produced by our core platform group is incorrectly specifying that the API call returns a TemplateSummary.

But the reality is that an array (of length 1) is being returned. I've filed internal bug EC-1876

At this point, I doubt that we'll change the API. But we should document the result correctly in the Swagger file. Once that's done, the next time the C# SDK is rebuilt, it will be fixed, along with the documentation. (They're both generated from the Swagger file.)

A question for you: in my test, the result was a 1 element array with an object that had templateId, uri, and name attributes. But your POSTMAN test doesn't show the latter. Did you leave it out? Did you test with API v2 or v2.1? (I used v2.1.)

Unfortunately, until the bug is fixed, I can only suggest that you call the API directly without using the SDK. See https://github.com/docusign/eg-03-csharp-auth-code-grant-core/blob/master/eg-03-csharp-auth-code-grant-core/Controllers/Eg010SendBinaryDocsController.cs for an example of how to do this with C#

ShawnCholeva commented 4 years ago

Hey @LarryKlugerDS ,

That was just a quick test that I ran against 2.1 sending an empty post body to see the response structure. Below is the curl for that request to get that response.

curl -X POST \
  https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/templates \
  -H 'Content-Type: application/json' \
  -H 'X-DocuSign-Authentication: {"Username": "username","Password": "password","IntegratorKey": "key"}' \
  -H 'cache-control: no-cache' \
  -d '{

}'
LarryKlugerDS commented 4 years ago

The blocking issue, EC-1876 has been fixed. I've asked for the SDK bug to be scheduled.