Where is createEnvelopeFromDocument() documented? - docusignapi

I am, more or less contentedly, using the DocuSign REST API through DocuSign's PHP library. I've imitated model code such as this:
$options = array(
"enforceSignerVisibility" => true,
);
$response = $service->signature->createEnvelopeFromDocument(
$emailSubject,
$emailBlurb,
$status,
$documents,
$recipients,
$eventNotifications,
$options
);
Now it's time to customize my envelope a bit more carefully: I want to set the address which will receive bounce notices, add a few Bcc recipients, and so on. Presumably all that will fit in $options somehow. I've located no documentation that I can interpret that way, though; certainly nothing I've found here has moved me forward.
How is $options defined? Where is it documented? How, specifically, can I customize the e-mail headers that result from use of createEnvelopeFromDocument()?

You are not using the officially supported DocuSign PHP Client (I can tell from the function name you've referenced). DocuSign now uses auto-generated SDKs from Swagger which I recommend you use- check out the DocuSign SDKs section of the Dev Center. You can also see an example of the PHP SDK in the QuickStart section.
The API docs you've referenced use a [Category->Resource->method] based representation of the DocuSign eSignature REST API. Therefore you want the Envelopes: create method.

Related

eSignature create envelope using API and activate the Send UI for manual tagging

I have created a web based application that allows for authentication and JWT impersonation. I can send a collection of documents and specify signers/recipients all just fine. I am trying to figure out how to get the DocuSign UI to open so the document signature and initials tags can be manually adjusted before the envelope is actually sent.
I have read through the SDK documentation and the QuickStart examples and since I am not using composer, I am not following the basic structures on how to call this UI. Are there any overly simplified code examples that show this process via API calls only and not utilizing a framework, just straight PHP?
Thank you in advance on this...
-greg
You are trying to use embedded sending and there's an [article you can][1] see on how to do that.
Here is the PHP code to get a URL back that you can use to embed the tagging of your envelope in your application:
Create sender view
$view_request = new \DocuSign\eSign\Model\ReturnUrlRequest(['return_url' => $args['ds_return_url']]);
$config = new \DocuSign\eSign\Configuration();
$config->setHost($args['base_path']);
$config->addDefaultHeader('Authorization', 'Bearer ' . $args['ds_access_token']);
$api_client = new \DocuSign\eSign\client\ApiClient($config);
$envelope_api = new \DocuSign\eSign\Api\EnvelopesApi($api_client);
$results = $envelope_api->createSenderView($args['account_id'], $envelope_id, $view_request);
# Switch to the Recipients / Documents view if requested by the user in the form
$url = $results['url'];
if ($args['starting_view'] == "recipient") {
$url = str_replace('send=1', 'send=0', $url);
}
return ['envelope_id' => $envelope_id, 'redirect_url' => $url];
}
Note: send=0 or send=1 specifies which page, the recipients selection or tagger is shown to your users first.
[1]: https://developers.docusign.com/docs/esign-rest-api/how-to/embedded-sending/

How can I get all envelopes status and their signers status in one request?

Is it possible to call the DocuSign API with the "docusign-client"-library in order to get status information about all envelopes with all of their recipients/signers in one request?
When we call the "EnvelopesApi.ListStatusAsync" method of the docusign client library we just retrieve an array of envelopes but without the status information of their signees.
public async Task<EnvelopesInformation> GetListStatus(EnvelopeIdsRequest envelopeIds, ListStatusOptions opt) {
return await Request(async api => await api.ListStatusAsync(settings.AccountId, envelopeIds, opt));
}
It seems that this information have to be determine in second request by calling
"EnvelopesApi.ListRecipientsAsync" method for every envelope.
Maybe someone have an idea or know how to call the API properly.
Are there any options we have to consider by calling the API or do we need to configure something in the DocuSign dashboard?
Thanks!
Remarks: In our environment we can't use webhooks. So we have to poll the DocuSign API.
No, it's not possible and maybe we should understand your statement about "we can't use webhooks".
My guess is that you have firewall or some private network and you can't have calls from outside into these servers. That's not a reason not to use webhooks.
There's a simple solution to this involving an intermediary cloud account that gets your webhooks and a queue mechanism for you to check for messages.
Here is a blog post by Larry that can help if you are willing to consider webhooks.
Yes, you're right. The main reason why we can't use webhooks is because the applicationn is behind a firewall and our customer do not want to make any changes on that.
Also I know the possibility of using DouSign with services like Azure or AWS to get notification about their bus-messaging system but this is something we do not want to implement yet. Maybe in the future.
We found out that we can use the "EnvelopesApi.ListStatusChangesAsync" method to get all of the status information we're interested in.
var options = new ListStatusChangesOptions {
envelopeIds = ids,
include = "recipients"
};
var result = await client.ListStatusChangesAsync(options);

DocuSign Apex API: Add sign here and date tabs

I have implemented Docusign's embedded signing using the apex toolkit for docusign. I have stored my document to be signed in Documents object. I want to add the sign here tab to the document and then send it to docusign. ANy ideas on how can I achieve this?
Below is the code i've used to generate the envelope. I need to add the sign here tab to the envelope:
Id mySourceId = '0012v00002WathI';
Id myDocumentId = '0692v00000AF1yP';
dfsle.Envelope myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(
new dfsle.Entity(mySourceId)) // The initiating Salesforce entity.
.withDocuments(dfsle.DocumentService.getDocuments(
ContentVersion.getSObjectType(),
new Set<Id> {
myDocumentId
}))
.withRecipients(new List<dfsle.Recipient> {
dfsle.Recipient.newEmbeddedSigner(),
});
myEnvelope = dfsle.EnvelopeService.sendEnvelope(
myEnvelope, // The envelope to send
true); // Send now?
I may be wrong but from what I remember when working with the apex toolkit it does not allow you to add tags to documents through Apex. I'm pretty sure what you have there should work and when you initiate the embedded signing process you will get to choose where the sign tags go. You could set up a template for this document to decide where the tags go beforehand (which is useful if you send the same document often) for how to add documents with templates to envelopes see this page at step 3. The toolkit documentation isn't very clear so you may want to watch a demo to see how the whole process works like this one. Hope this helps.

Is it possible to retrieve the RFC 2822 (or any) headers from an email with the Outlook/Office 365 REST API?

An application I am working on needs access to the headers of an email - specifically ones like return-path, in-reply-to, and references. Ideally, we would love to be able to access all of the RFC 2822 headers of the email. Is this possible with the Outlook/Office 365 REST API? If not, is it possible with any API?
UPDATE: The InternetMessageHeaders property was added to the beta endpoint of the Outlook API, so you can get this without using the extended property stuff. You do have to request the property explicitly via $select though. Something like:
GET https://outlook.office.com/api/beta/me/mailfolders/inbox/messages?
$select=Subject,InternetMessageHeaders
For Graph: The property also exists on messages in the beta endpoint for Graph, so you can do:
GET https://graph.microsoft.com/beta/me/mailfolders/inbox/messages?
$select=subject,internetMessageHeaders
For non-beta endpoints: The API doesn't directly provide access. However, you can access the PidTagTransportMessageHeaders MAPI property using the Extended Property API.
From the first link, we see that the property ID for PidTagTransportMessageHeaders is 0x7D, and the type is String. So the $expand parameter of your GET would look like:
$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D')
NOTE: This is only applicable for the Outlook endpoint (https://outlook.office.com). For Graph, see the answer from madsheep
Putting that together with a GET for a specific message, your request might look like:
GET https://outlook.office.com/api/v2.0/me/messages/{message-id}?
$select=Subject,SingleValueExtendedProperties
&$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D')
To all the poor souls lost in the insanties of MS Graph api - the answer above doesn't seem to be correct anymore as it will return error "PropertyId is not a property name" - it seems the correct answer now is:
GET https://graph.microsoft.com/beta/me/messages/{message-id}?
$select=Subject,SingleValueExtendedProperties&
$expand=SingleValueExtendedProperties($filter=id eq 'String 0x7D')
This is how you get the message headers from the Outlook/Office 365 REST Graph api.

Updating a wiki page with the REST API

How do you update a SharePoint 2013 wiki page using the REST API?
Three permutations:
Reading an existing page (content only)
Updating an existing page
Creating a new page
For reading an existing page, of course I can just to a "GET" of the correct URL, but this also brings down all the various decorations around the actual data on the wiki page-- rather than fish that out myself, it would be better if there was a way to just get the content if that is possible.
Are there special endpoints is the REST API that allow for any of these three operations on wiki pages?
As stated in GMasucci's post, there does not appear to be a clean or obvious way of instantiating pages through the REST API.
You can call the AddWikiPage method from the SOAP service at http://[site]/_vti_bin/Lists.asmx. This is an out of the box service that will be accessible unless it has been specifically locked down for whatever reason.
To read the content of a wiki page through the REST API, you can use the following endpoint:
https://[siteurl]/_vti_bin/client.svc/Web/GetFileByServerRelativeUrl('/page/to/wikipage.aspx')/ListItemAllFields
The content is contained within the WikiContent field. You may want to add a select to that URL and return it as JSON to reduce the amount of data getting passed over if that is a concern.
As for updating the content of an existing wiki page, it is not something I have tried but I would imagine it's just like populating another field through the REST API. This is how I would expect to do it:
Do a HTTP POST to the same endpoint as above
Use the following HTTP headers:
Cookie = "yourauthcookie"
Content-Type = "application/json;odata=verbose"
X-RequestDigest = "yourformdigest"
X-HTTP-Method, "MERGE"
If-Match = "etag value from entry node, returned from a GET to the above endpoint"
Post the following JSON body
{
"__metadata": { "type": "SP.Data.SitePagesItem" },
"WikiField" : "HTML entity coded wiki content goes here"
}
The interim answer I have found is to not utilise REST, as it appears to not be
fully documented
fully featured
supported across Sharepoint 2013 and On-line in the same way
So my current recommendation would be to utilise the SOAP services to achieve the same, as these are more documented and easily accessible.

Resources