Question

I'm sending documents to the DocuSign DEMO environment and they are being successfully received and notification emails are sent to signers. But the response is sent back in XML format despite the fact that I'm appending ".json" to the end of the URL, as per the instructions in document REST_API_Guide_v2.pdf (https://10226ec94e53f4ca538f-0035e62ac0d194a46695a3b225d72cc8.ssl.cf2.rackcdn.com/rest-api-guide-v2.pdf). This worked previously, I'm not sure if anything changed on the DocuSign side but I am running the same code that previously received and processed the response in JSON format.

The URL I'm posting to looks like the following:

https://demo.docusign.net/restapi/v2/accounts/999999/envelopes.json

and here is a sample response:

<envelopeSummary xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <envelopeId>91d1c2a4-7ad2-4ba1-a425-9656940dfbb5</envelopeId>
  <status>sent</status>
  <statusDateTime>2014-03-24T23:10:51.2859887Z</statusDateTime>
  <uri>/envelopes/91d1c2a4-7ad2-4ba1-a425-9656940dfbb5</uri>
</envelopeSummary>

Do I need to do something different now to have the response sent in JSON format?

Was it helpful?

Solution

Sounds like that might be a bug if it was working before and you haven't changed the code, but that's just one way of specifying the format. Try dropping the .json part of the URL, and that should switch to JSON right there since JSON is the default format when nothing else is specified.

If for some reason that does not work then you can also specify sending and receiving JSON format by setting the http Content-Type and Accept headers to value application/json. That should do the trick.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top