Checking API Logs Like the Weather
A couple weeks ago I was working on a prototype for a new feature, and somehow I kept getting an error from the DocuSign API. The error stubbornly told me that I was providing the wrong content type, even though I was certain that I was explicitly specifying “application/json." I could probably spend a lot longer on this if it wasn’t for a helpful request logging feature, that was actually implemented nearly a year ago.
What’s interesting about request logging is that it’s available to all users, not just developers. Having wide availability allows your support staff to be able to debug problems with your user’s account, while they maintain full control. Just ask them to go to My Preferences / Privacy & Security and at the bottom enable “Request Logging."
The error I was getting was:
"message": "Content Type specified is not supported.”
Even though I though I was setting the content correctly:
HttpRequest httpRequest = new HttpRequest();
httpRequest.setEndPoint(this.apiUrl + '/accounts/' + account + '/envelopes' );
httpRequest.setHeader('X-DocuSign-Authentication', header( email, password));
The cool thing about request logging in DocuSign is that it logged my request body as well as headers. What I realized is that I mistyped the header and should have specified in:
The default Content from this HTTP library was “application/x-www-form-urlencoded.” When I saw the logs on the server side and saw both Content-Type and Content, the problem became crystal clear.
Getting the API logs is also available via API!
If you are developing an application and having problems, or if your customer is having an issue using your integration, this could be an easy way to get to the root of the problem. DocuSign has been using the feature to help hundreds of customers who have had trouble with third party software packages.