Embed Signature Box in Document with PHP

Thanks, please let me know when this will be fixed. I want to launch my new website service and this is holding me up. Thanks.

Also I have one other question. I also want to query for the signature audit log data. Can you point me towards some documentation or give me an example of doing this with php and api?

Hello,

Sure we will notify you when the issue will be fixed.

As for audit log - Please check this method , it allows you to get audit logs for the envelop.

Thanks for sending the correct api endpoint and args needed to get audit log data.

This method takes two arguments: userGuid and envelopeGuid. The problem is that I want to get audit log for entire envelope history for all users, not for a specific user. Why is userGuid required? Can I just send the administrator account userGuid in order to get a ‘global’ look at the envelope audit log? If so how do I get the administrator userGuid?

Can you point me towards a php wrapper example? I’m using the PHP wrapper that you wrote, I got it from github. I really need an example so that I can be sure I’m creating all the write objects and performing this call correctly.

Thanks for your help.

Hello,

Yes, in case that you use admin/envelop owner credentials you will get entire log for the envelop.

Please check this PHP example for how to:

$clientId = “your admin client id”;
$privateKey = “”;
$envelopId = “your envelop id”;
//###Create Signer, ApiClient and Management Api objects
//Create signer object
$signer = new GroupDocsRequestSigner($privateKey);
//Create apiClient object
$apiClient = new APIClient($signer);
//Create Signature API object
$signutureApi = new SignatureApi($apiClient);
//Get logs for the envelop
$logs = $signutureApi->GetEnvelopeAuditLogs($clientId, $envelopId);

Thank you for the example. can you please tell me one more thing about this please?
Does this look right:

//make the api call
try {
$logs = $groupDocs->signature->GetEnvelopeAuditLogs($this->groupdocs_clientId, $gdEnvelopeId);
if ($logs->status == “Ok”) {//successful retrieval of envelope audit log data
return $logs;

} else {
throw new Exception($logs->error_message);
}

} catch (Exception $e) {
$error = 'ERROR: ’ . $e->getMessage() . “\n”;
}

Hello,

In general yes, it’s correct, but we are not sure about your construction: $groupDocs->signature->GetEnvelopeAuditLogs

Could you please show how do you created the $groupDocs object - looks like you have redefined GroupDocs classes by putting all GroupDocs classes in to the one class, is that correct?

Heres how I created the groupdocs object that you guys weren’t sure about

/**
* create the autoloader function for groupdocs library classes
*
* get and use the $groupDocs obj properties to get the needed groupdocs api objects
* $groupDocs = $this->groupDocsAutoLoad();
* $groupDocs->signer = $signer;
* $groupDocs->apiClient = $apiClient;
* $groupDocs->storageApi = $storageApi;
* $groupDocs->signature = $signature;
* $groupDocs->docApi = $docApi;
* $groupDocs->asyncyApi = $asyncApi;
**/
function groupDocsAutoLoad() {
if ( (class_exists(‘GroupDocsRequestSigner’)) &&
(class_exists(‘APIClient’)) &&
(class_exists(‘StorageApi’)) &&
(class_exists(‘SignatureApi’)) &&
(class_exists(‘DocApi’)) &&
(class_exists(‘AsyncApi’)) ) { //don’t load if instances already exist

//Create Signer, ApiClient and Storage Api objects
$signer = new GroupDocsRequestSigner($this->groupdocs_privateKey);
$apiClient = new APIClient($signer);
$storageApi = new StorageApi($apiClient);
$signature = new SignatureApi($apiClient);
$docApi = new DocApi($apiClient);
$asyncApi = new AsyncApi($apiClient);

} else { //load the needed library files
include_once(JPATH_COMPONENT . ‘/libraries/groupdocs/APIClient.php’);
include_once(JPATH_COMPONENT . ‘/libraries/groupdocs/StorageApi.php’);
include_once(JPATH_COMPONENT . ‘/libraries/groupdocs/GroupDocsRequestSigner.php’);
include_once(JPATH_COMPONENT . ‘/libraries/groupdocs/FileStream.php’);
include_once(JPATH_COMPONENT . ‘/libraries/groupdocs/SignatureApi.php’);
include_once(JPATH_COMPONENT . ‘/libraries/groupdocs/DocApi.php’);
include_once(JPATH_COMPONENT . ‘/libraries/groupdocs/AsyncApi.php’);
$signer = new GroupDocsRequestSigner($this->groupdocs_privateKey);
$apiClient = new APIClient($signer);
$storageApi = new StorageApi($apiClient);
$signature = new SignatureApi($apiClient);
$docApi = new DocApi($apiClient);
$asyncApi = new AsyncApi($apiClient);
}

//create the object of groupdocs objects for easy, organized use
$lib = new stdClass;
$lib->signer = $signer;
$lib->apiClient = $apiClient;
$lib->storageApi = $storageApi;
$lib->signature = $signature;
$lib->docApi = $docApi;
$lib->asyncApi = $asyncApi;

return $lib;
}

Hello,

Thank you for the example. Yes, all looks good and correct. Do you have tried to use GetEnvelopeAuditLogs method?

Yes I have called the method. I have a question about the data that is returned. The response object looks like this:

{
[“result”]=> {
[“envelopeId”]=> string(32) “5ab87a0fa3b8a3716086fd341e5fe0c7”
[“logs”]=> array(10) {
[0]=> {
[“id”]=> string(32) “b68d3d6adaa10856afbb253bf74806c4”
[“type”]=> int(1)
[“DateTime”]=> NULL
[“userName”]=> string(17) “Emmanuel Sullivan”
[“action”]=> string(16) “Envelope created”
[“remoteAddress”]=> string(12) “69.7.187.205”
[“details”]=> string(0) “”
}
[1]=> {
[“id”]=> string(32) “5ee356b841326c6a849cde468e7515ef”
[“type”]=> int(1)
[“DateTime”]=> NULL
[“userName”]=> string(17) “Emmanuel Sullivan”
[“action”]=> string(15) “Recipient added”
[“remoteAddress”]=> string(12) “69.7.187.205”
[“details”]=> string(27) “Recipient: Professional CRM”
}

You’ll notice that the DateTime property is NULL. Why is it NULL? I need the datetime that the events happened, thats the whole point of an audit log is to know who did what action and when did they do the action.

Hello,

We have checked this issue and we have fixed it. To resolve the issue please update GroupDocs PHP SDK to 2.3.1 version or you can simply open “SignatureEnvelopeAuditLogInfo” model (placed in the Model folder of the SDK) and rename “DateTime” parameter to “Date”.

For example here is how it’s should be:

class SignatureEnvelopeAuditLogInfo {

static $swaggerTypes = array(
‘id’ => ‘string’,
‘type’ => ‘int’,
‘Date’ => ‘string’,
‘userName’ => ‘string’,
‘action’ => ‘string’,
‘remoteAddress’ => ‘string’,
‘details’ => ‘string’

);

public $id; // string
public $type; // int
public $Date; // string
public $userName; // string
public $action; // string
public $remoteAddress; // string
public $details; // string

}