I am trying to call this web service via a wordpress plugin:
https://na25.salesforce.com/services/apexrest/echosign_dev1/template/load/a1t31500002HmjV?email=VAR
Adobe said I need to have a valid session ID so I did this:
Created a connected app Used Oath2 to get an access token (which if I echo it I can see the auth is working because I get back my token) Now using a submit to CURL that address as so
$sf_sig = 'https://na25.salesforce.com/services/apexrest/echosign_dev1/template/load/a1t31500002HmjV?email='. $email;
//open connection
$ch = curl_init();
$ch2 = curl_init();
//ch2
curl_setopt($ch2, CURLOPT_URL, $sf_sig);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_HTTPHEADER, array("Authorization: OAuth $access_token"));
curl_setopt($ch2, CURLOPT_POST, true);
curl_setopt($ch2, CURLOPT_POSTFIELDS, '');
//create the multiple cURL handle
$mh = curl_multi_init();
//add the two handles
curl_multi_add_handle($mh,$ch);
curl_multi_add_handle($mh,$ch2);
$active = null;
//execute the handles
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
//close the handles
curl_multi_remove_handle($mh, $ch);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
The first CURL (which I didnt post) works fine but this one doesnt work. I have tried changing the Auth to Bearer as well and nothing. I am not sure where to find the debug logs in salesforce since I am new to this, but the code seems like it should work?