Delete Envelope in created state - docusignapi

How can I delete a draft envelope using REST API? (status=created). I want to be able to destroy the envelope as it needs changes to subject and email blurb which I have been told is not possible via REST API after the creation of the envelope.

To Delete through the DocuSign Console:
You can delete an envelope from your Drafts folder by navigating to that folder, selecting the envelope(s) in question, and deleting through the UI.
To Delete through the DocuSign REST API:
This is not well documented at the moment but this can be accomplished by using the MoveEnvelope() call and moving it into your Recycle Bin folder. The following page from the REST API guide describes the call you need make:
DocuSign REST API Guide - Move Envelopes
The details of the call are as follows:
URL:
/accounts/{accountId}/folders/{folderId}
Method:
PUT
Body:
{
"envelopeIds": [
"sample string 1",
"sample string 2"
],
"fromFolderId": "sample string 1"
}
As with all other calls, this can be formatted in JSON or XML. If using XML request bodies, use the following:
<envelopeMoveRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.com/restapi">
<envelopeIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>sample string 1</d2p1:string>
<d2p1:string>sample string 2</d2p1:string>
</envelopeIds>
<fromFolderId>sample string 1</fromFolderId>
</envelopeMoveRequest>

Related

docuSign - envelopeViews : createRecipient

ERROR: Content Type specified is not supported.
Hi there, I am new to DocuSign and I am trying to learn the implementation from last couple of days. What I did so far is, created a developer account and created a QuickStart project.
Goal
I want to integrate the DocuSign API's in my application, but I don't really want the user to leave my application. I just want to make use of DocuSign within my app. - Embedded Signing
What I did?
I successfully created an envelope with a sample document and after that I have to get that URL to view (for Recipient).
So I called the below API:
** EnvelopeViews: createRecipient**
** POST - {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/views/recipient**
All the details, like accountId, envelopeId are correct, along with that the request body that I pass with this is:
Request Body
{
"authenticationMethod": "none",
"clientUserId": "bcc49234-f30b-XXXX-XXXX-XXXXXXXXXXXX",
"email": "abc#gmail.com",
"recipientId": "007",
"returnUrl":"http://localhost",
"userName": "user name"
}
Note: * clientUserId is my Integration Key (please let me know if this is what I need to pass here or something else).*
Response
{
"errorCode": "INVALID_CONTENT_TYPE",
"message": "Content Type specified is not supported."
}
Note: Apart from the solution, please provide any link(s) to resources where I can easily see the implementation(as in my use case).
Umair,
First clientUserId is a bit of a confusing term, it's not the IK (Integration Key) but any string you want. It is unique to the signer and the envelope. You choose it.
You can find a detailed example of this with code in 8 languages on the DocuSign Developer Center How To Request Signature Through your app page.
I'm not clear how you make the API calls, if you are using postman, there are headers that needs to be set. One of them is called Content-Type and it has to be set to text/plain.

Move envelopes Feature in Docusign

Problem: Envelopes moved to recycle bin are been showing up in the report even after 2 days. We are using EnvelopesApi.listStatusChanges to get the envelope status
Description:
We are using move envelopes feature to move the envelopes to the recycle bin and eventually after 1 day the envelope being moved is removed from the account and we can no longer see the envelope in any of the folders. But interestingly the envelope that's been moved is shown up when we made an API call EnvelopesApi.listStatusChange and even it's been showing up when we made the Rest call get envelope status /accounts/{accountId}/envelopes
Question
Is there a way to identify such kinds of envelopes that have been moved to recycle bin and no longer been available in any of the folders but shown up through the API Calls?. Looking to see if we can identify such kind of envelopes with any parameters that have been returned from any of the API calls
You should call below URI, as documented here:
GET /v2/accounts/{accountId}/folders
to know all the folders you have access to, this will also return the recyclebin folder uri, response will be like below:
{
"ownerUserName": "Sender Nae",
"ownerEmail": "email#gmail.com",
"ownerUserId": "87b00103-461d-487b-8928-1991dfdb8d19",
"type": "recyclebin",
"name": "Deleted Items",
"uri": "/folders/2fdc7ffc-60d5-4c36-9f9a-1410c30de0eb",
"folderId": "2fdc7ffc-60d5-4c36-9f9a-1410c30de0eb"
}
Now, read folderId or uri from the response for type - recyclebin, and call below uri to know all the envelopes which have been moved to recyclebin. Details are available at DS Docs
GET /restapi/v2/accounts/{accountId}/folders/2fdc7ffc-60d5-4c36-9f9a-1410c30de0eb

DocuSign API - Reset/Unlock RecipientAuthenticationStatus

I'm using the DocuSign API to electronically sign documents within my app. I'm using the access code authentication feature, for some additional security; however, I am trying to 'Unlock' a signer (via the API) that has input the wrong access code too many times, without voided and creating a new envelope, or using the DocuSign Admin interface.
I don't care if I have to resend the initial email, I just want to be able to conserve my client's total envelope count. It's also important (if there are multiple signers) that I don't force one signer to have to sign multiple times, if they completed their signatures prior to signer2's authentication error.
I have attempted a POST to:
/v2/accounts/{accountId}/envelopes/{envelopeId}?resend_envelope=true
I have also sought a solution using the docusign-java-client:
Recipients recipients = envelopesApi.listRecipients(accountId, envelopeId);
List<Signer> signers = recipients.getSigners();
for (Signer signer : signers) {
signer.setRecipientAuthenticationStatus(null);
}
I still get the below response
"recipientAuthenticationStatus": {
"accessCodeResult": {
"status": "Failed",
"eventTimestamp": "2018-01-15T23:49:15.8600000Z"
}
I'm able to "Resend" via the DocuSign admin GUI, and everything works as expected...
Is there any way that I'm able "reset/unlock" this authentication feature programatically, through the API?
You can use below PUT endpoint
PUT /restapi/v2/accounts/<accountId>/envelopes/<envelopeId>?resend_envelope=true
Body as:
{
}
This should send another email to the signer who failed the authentication, and that user will again get option to enter the access code.
I think you will need to delete and then re-add the recipient (signer). That makes the signer become a new recipient.
However, doing so means you'll need to re-create everything about the signer: their document tabs/fields, etc.
I can't imagine that it is less expensive to simply void/resend the envelope than to spend a developer's time to work on this issue.
If this scenario is occurring a lot, then perhaps think about providing better training to your signers with respect to using the access code feature.
Per the documentation found here
I must include the json or xml with the request (if the authentication method failed). I assumed incorrectly that if there was only one recipient, then I would NOT have to specify. If you just want to resend the envelope, you don't need to include and signer data.
Such as:
{"signers" :
[{"email":"testEmail#gmail.com",
"name":"FirstName LastName",
"recipientId":"1"
}]
}
You should then get something like the below response:
{"recipientUpdateResults":
[{
"recipientId": "1",
"errorDetails":
{
"errorCode": "SUCCESS",
"message": ""
}
}]
}

Getting the email id from the Outlook REST API when sending email

I am trying to use the Microsoft Rest API to send emails on behalf of our users. When I create a message as a draft, I get back an ID that I can use in future requests for editing, deleting, viewing the full conversation (after it is sent), etc.
I do not want to save it as a draft since I have no reason to, I just want to send it directly. After it is sent, I would still like to view the full conversation. However, if I just send the email (using the /sendmail endpoint), I do not get that ID. Is there anyway to get it? Here is my request:
POST https://outlook.office.com/api/v2.0/Users/email/sendmail
{
"Message": {
"Subject": "Test",
"Importance": "Normal",
"ToRecipients": [{
"EmailAddress": {
"Address": "<email>",
"Name": "<name>"
}
}],
"Sender": {
"EmailAddress": {
"Address": "<email",
"Name": "<name>"
}
},
"Body": {
"ContentType": "HTML",
"Content": "<html>\\n<head>\\n <style>\\n p { color: red; }\\n </style> \\n</head>\\n<body>\\n <p>Test</p>\\n</body>\\n</html>\\n"
}
},
"SaveToSentItems": "true"
}
The HTTP response code is 202, the email sends, but the body is empty (no content, whatsoever).
I don't think this matters, since I can recreate this in Postman, but I am running this in Nodejs using the node-outlook package.
Emails in Exchange via REST and EWS are submitted for transport, but the actual send and subsequent save to the sent items folder are done async. This is why you don't get the id. Transport is who actually writes the email to the sent items folder, not REST.
If you really need to find the item after it has been saved to the sentItems folder, set something like the PR_SEARCH_KEY and then do a view of the sent items folder and seek to that search key value.
Also note when you save a draft, the id that you get back will be different than the id of the item in the sent items folder because the folder Id is part of the id of the item, so that id wouldn't help you anyways.
I don't know which rest api version are you using (i'm using v2.0) but i will try to explain this issue. Sorry for my english i advance.
You have 2 ways to reply a message: on the fly way or the complete way.
On the fly way
Its the easy way, just send a post request to
https://outlook.office.com/api/v2.0/me/messages/{message_id}/reply
or
https://outlook.office.com/api/v2.0/me/messages/{message_id}/replyall
and with the body
{
"Comment": "This is your message in plain text or html code"
}
and thats all.
The problem with this methos that you can only send plain text or HTML, no attachments or anything else. If that's all you need this is your best option.
The complete way
If you need to send an attachment or perform any other action you need to perform these 3 steps:
1. Create a draft from the message you want to reply
Send a post request to
https://outlook.office.com/api/v2.0/me/messages/{message_id}/createreply
This will give you an json object save the "Id" property {draft_id} of this draft for later use.
2. Update the draft
Send a patch request to
https://outlook.office.com/api/v2.0/me/messages/{draft_id}
and with the body
{
"Body": {
"ContentType": "HTML or Text",
"Content": "Your response in plain text or html"
}
}
or any other parameter you want to change.
3. Send the draft
Send a post request to
https://outlook.office.com/api/v2.0/me/messages/{draft_id}/send
And thats it.
If you need more info abut this check https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations

Manipulate the document name through Connect

Is it possible to manipulate the document name when it is sent back to us using DocuSign Connect?
We have multiple envelopes with a single document in each envelope however the name of the PDF document getting sent back to us from DocuSign has the same name so it's overwriting the previously saved document. We use the Connect method so we receive an XML file with the document pdf's and other information. I'm trying to use the name of the document that is in the envelope.
You cannot rename the document through DocuSign Connect, however you have complete control over the document name when you are adding it to the envelope. If you're adding through the DocuSign Console then you can just rename the file on disk before uploading. If you're adding through the API, then you control the document name through the name property of the documents section of your request body:
"documents": [
{
"name": "DocumentNameHere.pdf",
"documentId": "1",
"order": "1"
}
]
When adding through the API you can programmatically set the name to whatever you want - for instance you can prompt the user of your code to enter a name, or you can append a date+time string to your filename if you're worried about file overwriting.

Resources