Can't download Docusign document when envelope name has quotes - docusignapi

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.

Related

Understanding Azure Bot - why can't I get attached file data

I am new to using azure bot service
I have a bot that is used inside Microsoft Teams
I use this bot to send and receive messages inside Microsoft teams
When the user tags the bot and sends a text message I get it in the activity response
But when the user tags the bot and sends an image attached to the message I do not get any information about that image
"attachments" : [ {
"contentType" : "text/html",
"content" : "<div><div><span itemscope=\"\" itemtype=\"http://schema.skype.com/Mention\" itemid=\"0\">BotName12</span> Msg </div>\n</div>"
} ],
above is what I get ,
I expect to get also "contentUrl","content" and "thumbnailUrl"
Is it related to permissions ? If so, where do I define it,
On the Bot, or on the Application related to it?
Thanks
I tried to reproduce the procedure and the image is being uploaded perfectly and the text message also sent successfully in MS Teams.
Follow the instructions mentioned below screen.
Click on Channels to choose MS Teams
Select Microsoft Teams and attach the created bot to Teams Channel. After channel attachment, click on open in teams
The above procedure may not be the code part, but the procedure to create the bot and attach to teams perfectly.
The required contentType and other attachments information can be retrieved by setting name property and contentUrl property to the URL related to the media file. content, contentType, contentUrl, name, thumbnailUrl are the properties need to be given. Then the Activity object which is responsible for your message will specify the Attachment object within your attachments array.
For example, consider the following code for the single image upload.
POST https://your-website/apis/v3/conversations/abcd1234/activities/5d5cdc723
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
Here comes, the JSON response for the content uploaded as an attachment
{
"type": "message",
"from": {
"id": "234567",
"name": "sender's name"
},
"conversation": {
"id": "user234",
"name": "conversation's name"
},
"recipient": {
"id": "bot234",
"name": "recipient's name"
},
"text": "Here's a picture of the duck I was telling you about.",
"attachments": [
{
"contentType": "image/jpg",
"contentUrl": "image URL"
}
],
"replyToId": "234"
}
To implement different types of media cards if needed refer. We can include AudioCards as well.

Embedded Signing - Signing from My App

I'm working on get the signing process on an iFrame to Embedded docusign on my app.
I have trying to work on this based on this tutorials:
Docusign Embedded Signing using template
https://developers.docusign.com/esign-rest-api/guides/features/embedding
Based on what I understood, if you want to embedded you have to create the "create the envelope on the fly". So you don't specify the templateId correct?
So what I don't fully get is, how I get the documentBase64 string value? I have to get it manually? Or docusing api has an endpoint that will return that?
Also I want to know, what happen to the custom fields I added to the template? I can't use them?
Right now this is the json I'm sending:
{{baseUrl}}/envelopes
{
"emailSubject":"This is a custom email subjet, look at the doc.",
"status":"sent",
"templateId":"a0847413-35ac-48ed-9ed6-9b7f96019eda",
"templateRoles":[
{
"email":"mauriciotaranto#email.com",
"name":"Mauricio T",
"clientUserId": "1234",
"roleName":"Test",
"routingOrder":"1",
"tabs": {
"textTabs": [
{
"tabLabel": "Custom",
"value": "This is a custom value"
},
{
"tabLabel": "NewCustom",
"value": "Another custom value added using API"
},
{
"tabLabel": "NewCustom1",
"value": "Last custom value added using API"
}
]
}
}
],
}
And then I go to the recipient view to get the URL:
{{baseUrl}}/envelopes/{{envelopeId}}/views/recipient
{
"returnUrl": "https://www.google.com.uy",
"authenticationMethod": "None",
"email": "mauriciotaranto#email.com",
"userName": "Mauricio T",
"clientUserId": "1234"
}
As far as I understood this way will not allow the user to sing the document.
Need to do it with the document instead.
Can you explain to me how this should work?
Thanks!
UPDATE:
Im manually parsing the bytes of the document to base64. and send this json:
"status":"sent",
"emailSubject":"Envelope with Embedded Signer",
"documents":[
{
"documentId":"1",
"name":"contract.pdf",
"documentBase64":bytes
}
],
"recipients":{
"signers":[
{
"email":"mauriciotaranto#hotmail.com",
"name":"Mauricio T",
"recipientId":"1",
"clientUserId":"1234"
}
]
}
}
I change the headers, add the accept: application/json and content-type: multipart/from-data
And this is the response I get:
{
"errorCode": "ENVELOPE_IS_INCOMPLETE",
"message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Content-Type does not contain boundary parameter."
}
You can create envelopes in any way, either by using Templates or by passing base64 of document or both as well using Composite Template. When you send templates, then you already have added signers tabs on the document in the templates so you just need to populate the signer details like name and email in creating an envelope and/or pre-populate the DS Tabs value. But when you send document as base64, then you need to tell DocuSign how to add DS Tabs on the document, either by using
X and Y position of the tabs
AnchorString
PDF Field Transformation
Embedded Signing is a type of signing, to implement that you need to just add clientUserId in the signers details. This can be done in both ways either by using template or by passing document as base64 or both as well using Composite Template. Once you have an embedded signer by adding clientUserId then you need to generate signing URL as explained in your qs, by using Recipient View URL, as soon as URL is generated then you will open this URL in IFrame or on new tab.
In the link which you shared is having very small code snippet and it does not have complete example, check Complete Example, and you will see that they are adding DS Tabs on the document using X/Y position.

Outlook Mail REST API: send message with attachment

I'm trying to use next API method: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessages. Sending messages without attachments works just fine, but I can not understand how to send message with attachments.
According to docs, Message structure can contain array of Attachments with items of type https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesFileAttachment . Problem is in the field ContentBytes -- it is impossible to dump bytes to JSON before sending request to this API method (actually dumping any BLOB to JSON is nonsense).
How should I pass Attachments using REST API at all?
Thanks.
There's an example of passing the attachment on that page: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessageOnTheFly
I know I'm 3 years late but, you can look at this example:
https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#create-and-send-messages (if you don't get forwarded to the section "Create and send messages", please scroll manually).
I know it is 365 and not Microsoft Graph but request is absolutely same.
This is basically how JSON representation of the post method looks:
https://outlook.office.com/api/v2.0/me/sendmail
{
"Message":
{
"Subject": "Meet for lunch?",
"Body": {
"ContentType": "Text",
"Content": "The new cafeteria is open."
},
"ToRecipients": [
{
"EmailAddress": {
"Address": "garthf#a830edad9050849NDA1.onmicrosoft.com"
}
}
],
"Attachments": [
{
"#odata.type": "#Microsoft.OutlookServices.FileAttachment",
"Name": "menu.txt",
"ContentBytes": "bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
]
}
}

How to add document in DocuSign

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",

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