Jodo1992 Jodo1992 - 1 year ago 178
JSON Question

How do I use this JSON file to Request from a Server?

I have this JSON file that DocuSign gives me as an example when getting user login information:

"uri" : "" ,
"headers" : {
"X-DocuSign-Authentication" : "{\Username\":\ ... " // Truncated due to sensitive
// information

Their API Exploration environment (using the sensitive information) then accesses the server and returns another JSON file with all of the login information of the user.

How does docusign do this using a
method? I'm trying to accomplish these requests using PHP.

Answer Source

I believe it's just an example on their page that just so happens to represent the data in JSON format, probably because it's familiar to most web developers. You could do some fancy json decoding to programmatically insert the values into your request if you're receiving that JSON through another API, but that's probably more than most people need to do.

You are sending a payload via GET for all parameters after the question mark in the URL


You're providing the authentication credentials as a header.


$uri = '';
$headers = 'X-DocuSign-Authentication: {"Username":"","Password":"","IntegratorKey":""}';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$uri);

curl_setopt($ch, CURLOPT_HTTPHEADER, array($headers));

curl_exec ($ch);

curl_close ($ch);

This gives me an expected response because I have no username account:

{ "errorCode": "PARTNER_AUTHENTICATION_FAILED", "message": "The specified Integrator Key was not found or is disabled. An Integrator key was not specified." }

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download