How to add document in DocuSign - node.js

I have following request to be sent to DocuSign API,
"emailSubject": 'DocuSign API - Signature Request on Document Call',
"documents": [{
"name": test.pdf,
"documentId": 1,
}]
What I dont understand is, where should the documents name be present and what about the documentId.
I got an error as follows:
{ errorCode: 'INVALID_REQUEST_PARAMETER',
message: 'The request contained at least one invalid parameter. A document was defined without setting the \'name\' field.' }
Error calling webservice, status is: 400
I think it cannot find the pdf.

You should fill in a correct path into name field:
"name": "path/to/existing/pdf/test.pdf",

Related

Adding a mailbox filter to Gmail

I am trying to add a simple mailbox filter to Gmail, and getting error 400. The response text says that "Filter doesn't have any criteria" but of course I believe I do. Here is the payload data:
{
"filter": [{
"id": "ABC12345-2",
"criteria": {
"from": "donald trump"
},
"action": {
"addLabelIds": ["TRASH"]
}
}]
}
This is the URL that I am posting to:
https://gmail.googleapis.com/gmail/v1/users/{userId}/settings/filters
There is no problem with authentication. I have tried it with and without the "id" field. Any ideas about what I am doing wrong?
I'm not sure about your actual script. So I'm not sure about the requirement of {"filter": []}. But when I saw the official document, it seems that the sample request body for the endpoint of POST https://gmail.googleapis.com/gmail/v1/users/{userId}/settings/filters is as follows, when your request body is used.
Sample request body:
{
"id": "###",
"criteria": {"from": "###"},
"action": {"addLabelIds": ["TRASH"]}
}
id: string, The server assigned ID of the filter.
criteria: object (Criteria), Matching criteria for the filter.
action: object (Action), Action that the filter performs.
In this case, even when id is not used, no error occurs.
You can also test above at "Try this API".
References:
Method: users.settings.filters.create
Resource: Filter

Error deleting tabs in envelope

I'm having an issue when trying to delete a tab using the REST API which fails at the following URL:
https://demo.docusign.net/restapi/2/accounts/{accountID}/envelopes/{envelopeID}/recipients/1/tabs
DELETE with body {"checkboxTabs":[{"tabId":"168229c3-d717-436f-b6a9-5f014d1817bb"}]} gets:
{
"checkboxTabs": [
{
"selected": "false",
"requireInitialOnSharedChange": "false",
"recipientId": "1",
"tabId": "168229c3-d717-436f-b6a9-5f014d1817bb",
"errorDetails": {
"errorCode": "INVALID_TAB_OPERATION",
"message": "The Tab specified is not valid for the requested operation."
}
}
]
}
It's unclear what the problem is and I cannot find a good example of the correct usage. Is it possible that the tab wasn't found to delete?
UPDATE
I also tried an UPDATE instead of a DELETE and I got the following response body (interestingly the response shows textTabs instead of checkboxTabs):
{
"textTabs": [
{
"requireAll": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"documentId": "1",
"recipientId": "1",
"tabId": "00000000-0000-0000-0000-000000000000",
"errorDetails": {
"errorCode": "INVALID_TAB_OPERATION",
"message": "The Tab specified is not valid for the requested operation. The Tab specified is not valid for the requested operation. Recipient not in state that allows correction."
}
}
]
}
However this time the error message also contained "Recipient not in state that allows correction" which means I'm attempting an invalid operation as the recipient had already signed? If someone can clarify that would help my understanding.
It would be very useful if the DELETE method also contained a similar message.
That error should appear if the tabID does not exist. I'd recommend a double check the tabID by performing a GET against the same URL.
I believe you'll get that error if ANY of the tab properties you specify are incorrect. For instance, you might be referring to the correct tabId but if the tab in question is on document 2 (for example) and you are referencing documentId = 1 in your request you'll get that error.
I recommend that right before you send the DELETE request to first do a GET on the tab and then inspect all the properties returned and verify that they all match what you are sending out in your delete request.
UPDATE
I just realized what you're probably running into. The EnvelopeTabs: delete API request you are trying to make says this for the description
"Deletes one or more tabs associated with a recipient in a draft envelope."
I believe this is only for DRAFT envelopes. Once you have sent the envelope you need to do an envelope correction if you want to change aspects about it. Your error message is also referencing this
"Recipient not in state that allows correction"

Can't download Docusign document when envelope name has quotes

I'm using the Docusign API (via the ruby docusign_rest gem) and repro'd this using Postman.
I have an envelope whose name has quotes in it. When I tried to download the signed PDF, I get an error message:
https://www.docusign.net/restapi/v2/accounts/{account_id}/envelopes/{envelope_id}/documents/1
{
"errorCode": "UNSPECIFIED_ERROR",
"message": "The format of value 'file; filename=\"My filename (\"MF\") has quotes.pdf\"; documentid=\"1\"' is invalid."
}
When I list the documents, it shows the name of the envelope having quotes.
https://www.docusign.net/restapi/v2/accounts/{account_id}/envelopes/{envelope_id}/documents
{
"envelopeId": "{envelope_id}",
"envelopeDocuments": [
{
"documentId": "1",
"name": "My filename (\"MF\") has quotes.pdf",
"type": "content",
"uri": "/envelopes/{envelop_id}/documents/1",
etc...
}
}
I can change my code to prevent quotes for new documents, but I have existing signed documents that I can't download. How can I download them? Or fix them?
You will need to properly escape the quotes in your json.
The only way to know what is really happening is to see the api logs.
Added
To see the api logs, you have two choices:
See the instructions
Use the API Logging Feature of the new (still beta) Recipe tool. has a more convenient interface to the API Logger.
Using the current docusign_rest release (v0.3.1) I was able to create an envelope with a quote in the document's filename and then download that document:
client = DocusignRest::Client.new
res = client.create_envelope_from_document(email: {subject: "test email subject",body: "this is the email body and it's large!"}, signers: [{embedded: true, name: 'Joe Dimaggio', email: 'joe.dimaggio#example.org', role_name: 'Issuer',sign_here_tabs: [{anchor_string: 'sign here',anchor_x_offset: '-30',anchor_y_offset: '35'}]},], files: [{path: '/Users/tomcopeland/github.com/docusign_rest/test".pdf', name: 'test".pdf'},],status: 'sent')
client.get_document_from_envelope(envelope_id: res['envelopeId'], document_id: "1", local_save_path: "/tmp/foobar.pdf")
client.get_documents_from_envelope(envelope_id: res['envelopeId'])["envelopeDocuments"].map {|d| d["name"] }
=> ["test\".pdf", "Summary"]
Also, this latest release supports call logging so, if needed, you can extract logs client-side.

Docusign API - Umlaut character in Recepient name

The recipient name has an umlaut character -> "François"
While sending the envelope to this recipient using the Docusign Rest API v2, I'm getting an error in response with
Error Code -> UNSPECIFIED_ERROR
Error Message -> An item with the same key has already been added.
If I change the recipient's name to a string with no umlaut characters, the envelope works.
Is there any way to fix this at an account level or while sending the request to Docusign?
Following is the request xml which works without the umlaut character ç in the recipient's name.
<envelopeDefinition><emailSubject>Agreement Name</emailSubject>
<status>sent</status><documents><document><name>Agreement Name</name>
<documentId>368649304</documentId><documentBase64>Document
Contents</documentBase64></document></documents><recipients><signers>
<signer><recipientId>1</recipientId><email>TestEmail</email>
<name>François Harnandez</name>
<routingOrder>1</routingOrder><tabs><signHereTabs><signHere>
<anchorString>ICLM_ExtSignature:1</anchorString></signHere></signHereTabs>
<dateSignedTabs><dateSigned><anchorString>ExtDate1</anchorString>/dateSigned>
</dateSignedTabs></tabs></signer></signers></recipients>
</envelopeDefinition>
I just tested this to see what I actually passed to the CURL request and here's what I get (json instead of xml) when I pass in Tèst User as a recipientName
Request
POST: https://{server}/restapi/v2/accounts/{accountId}/envelopes/
{
"emailSubject": "Testing",
"templateId": "{templateId}",
"status": "sent",
"templateRoles": [
{
"email": "email#domain.com",
"name": null,
"roleName": "Role 1",
"clientUserId": 12345654321
}
]
}
Response
{
"errorCode": "INVALID_USERNAME_FOR_RECIPIENT",
"message": "The user name for the recipient is invalid. The user name is invalid for recipient email email#domain.com"
}
I would expect this error message to come back if I'm passing in a null value, is your XML encoding stripping out that value? Can you see what you're actually passing to DocuSign with an entire response?
Could you try this request in JSON instead of XML ?
I have try in JSON with name "François" and I have no problem to send the request and to sign with this name : http://i.stack.imgur.com/vtWUc.png

Docusign API Invalid email address error with signature from document request with inPersonSigner recipient type

I'm currently testing an API call that will ultimately allow for an agent to provide signature and another party to sign in person. In sending the call via API Explorer I continue to receive the following response:
{
"errorCode": "INVALID_EMAIL_ADDRESS_FOR_RECIPIENT",
"message": "The email address for one of the recipients is not valid."
}
I've read in the REST API guide that this needs to be enabled for my account; it may be that my demo dev account does not have this enabled. I just need to verify whether or not that I'm not omitting any essential parameters in this call. I've tried passing in my email (as the account holder) and still receive this error. Here is my request body JSON:
{
"emailBlurb": "test",
"emailSubject": "test",
"documents": [
{
"name": "ChiropractorPlusApplication.pdf",
"documentId": "1"
}
],
"recipients": {
"inPersonSigners": [
{
"hostName": "Joe Host",
"recipientId": "1",
"name": "Name",
"email": "host#gmail.com",
"signerName": "Insured"
}
]
},
"status": "sent"
}
Thanks!
I believe you have found a bug with the REST API Explorer in that it's missing at least one field for In Person Signers. If you look at the REST API documentation you'll see that there's one more required parameter for In Person Signers, which is the hostEmail
Try adding to your JSON
"hostEmail" : "host's email address",
And I have a feeling that will do the trick. See page 275 of REST API v2 PDF for info on In Person Signers recipient type. It first shows a sample request with all the options then below that it lists the required fields for this recipient type:
http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf

Resources