Optional DocuSign editor before sending - json

I am using the DocuSign API to generate digital agreements. So far all has gone well, but I now have a requirement to optionally have the contract sent to a user for editing within DocuSign before it is sent to the signatories.
My existing API calls are fairly simple, just using a template for the document:
POST https://demo.docusign.net/restapi/v2/accounts/<account_id>/envelopes HTTP/1.1
{
"status": "sent",
"templateId": "<template_id>",
"templateRoles": [
{
"email": "person1#company.com",
"name": "Person One",
"roleName": "Signatory1"
},
{
"email": "person2#somewhere.com",
"name": "Person Two",
"roleName": "Signatory2"
}
]
}
I need to have the same template sent to an editing user to adjust the envelope details before delivering to the signatories.
Anybody had any luck with a similar requirement?
Things I have tried:
Adding a compositeTemplates to the above request with an inline template that has an editor. This unfortunately removes all of the fields from the document.
Placing the whole request in compositeTemplates with the template selected as a server template, and the recipients in an inline template. This does not correctly match up the recipient roles to the template roles.

You can use the following composite template to add an Editor in addition to the template roles you have.
{
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "2",
"templateId": "<template_id>"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "person1#company.com",
"name": "Person One",
"roleName": "Signatory1",
"recipientId": "1"
},
{
"email": "person2#company.com",
"name": "Person Two",
"roleName": "Signatory2",
"recipientId": "2"
}
],
"editors": [
{
"name": "person three",
"email": "personthree#company.com",
"recipientId": "3",
"routingOrder": "0"
}
]
}
}
]
}
]
}

Related

PayPal JSON format updating order

I know I am close on this, the error messages are getting nicer. Currently, I can call a similar call to update the seller's email no issue via Postman currently, working on updating the amount and associated objects. Something in my request format is off.
Is my breakdown section in the correct location? The amount_breakdown documentation looks like it is on same level as value and currency_code, so does it need to move into that section.
Here's my request JSON via Postman:
[
{
"op": "replace",
"path": "/purchase_units/#reference_id=='default'/amount",
"value": {
"currency_code": "CAD",
"value": "2",
"amount": {
"currency_code": "CAD",
"value": "2",
"breakdown": {
"item_total": {
"currency_code": "CAD",
"value": "2"
},
"tax_total": {
"value": "0",
"currency_code": "CAD"
}
}
},
"items": [
{
"name": "First Product Name",
"description": "Optional descriptive text..",
"unit_amount": {
"currency_code": "CAD",
"value": "2"
},
"tax": {
"value": "0",
"currency_code": "CAD"
},
"quantity": "1"
}
]
}
}
]
RESPONSE:
{
"name": "UNPROCESSABLE_ENTITY",
"details": [
{
"field": "/purchase_units/#reference_id=='default'/amount/breakdown/item_total",
"location": "body",
"issue": "ITEM_TOTAL_REQUIRED",
"description": "If item details are specified (items.unit_amount and items.quantity) corresponding amount.breakdown.item_total is required."
}
],
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "acecd3643c994",
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-ITEM_TOTAL_REQUIRED",
"rel": "information_link",
"method": "GET"
}
]
}
Thanks for any help!
Different variations of objects.
I can get the other PATCH operation working no issue but it is much simpler in object structure
There should be no amount key under the /amount path, and the items array does not belong at that /amount path either.

Compare 2 cucumber JSON reports with ruby

The problem is: I have 2 cucumber test reports in JSON format
I need to remove redundant key-value pairs from those reports and compare them, but I can't understand how to remove the unnecessary data from those 2 jsons because of their structure after JSON.parse (array or hash with many nested arrays/hashes). Please advice if there are some gems or known solutions to do this
JSON structure is e.g. :
[
{
"uri": "features/home_screen.feature",
"id": "as-a-user-i-want-to-explore-home-screen",
"keyword": "Feature",
"name": "As a user I want to explore home screen",
"description": "",
"line": 2,
"tags": [
{
"name": "#home_screen",
"line": 1
}
],
"elements": [
{
"keyword": "Background",
"name": "",
"description": "",
"line": 3,
"type": "background",
"before": [
{
"match": {
"location": "features/step_definitions/support/hooks.rb:1"
},
"result": {
"status": "passed",
"duration": 505329000
}
}
],
"steps": [
{
"keyword": "Given ",
"name": "I click OK button in popup",
"line": 4,
"match": {
"location": "features/step_definitions/registration_steps.rb:91"
},
"result": {
"status": "passed",
"duration": 2329140000
}
},
{
"keyword": "And ",
"name": "I click Allow button in popup",
"line": 5,
"match": {
"location": "features/step_definitions/registration_steps.rb:96"
},
"result": {
"status": "passed",
"duration": 1861776000
}
}
]
},
Since you are asking for a gem, you might try iteraptor I have created exactly for this kind of tasks.
It allows iterating, mapping and reducing the deeply nested structures. For instance, to filter out all the keys called "name" on all levels, you might do:
input.iteraptor.reject(/name/)
The more detailed description might be found on the github page linked above.

Getting an API generated in-person signing envelope tracked through Salesforce Connect

I'm using the rest API to create an in person signing session from salesforce. My envelope creation json is like this:
{
"documents": [{
"documentBase64": "'+base64EncodedDocToSign+'",
"documentId": "1",
"fileExtension": "pdf",
"name": "contract.pdf"
}
],
"emailSubject": "Please Sign",
"recipients": {
"inPersonSigners": [{
"email": "some#gsome.com",
"name": "Luis",
"hostEmail": "some#gsome.com",
"hostName": "Luis",
"signerEmail": "other#gother.com",
"signerName": "Charles",
"recipientId": "1",
"tabs": {
"signHereTabs": [{
"anchorString": "s1",
"anchorXOffset": "0",
"anchorYOffset": "0",
"anchorIgnoreIfNotPresent": "false",
"anchorUnits": "inches"
}
]
},
"routingOrder": "1",
"clientUserId": "1000",
"embeddedRecipientStartURL": "SIGN_AT_DOCUSIGN",
}
]
},
"status": "sent"
}
The next step would be for the object to be tracked using Connect. Connect is properly configured for the object and works if I "Sign with Docusign" or use a custom button.
I understand I must change the json to include the DSFSSourceObjectId custom field, with value equal to the Id of the object that is originating the request, but if I try to get a customField in there the json is not properly formatted anymore.
I tried adding the customField like:
...
}
]
},
"customFields": [
{
"Name": "DSFSSourceObjectId",
"Value": "' + objectId + '"
}
],
"status": "sent"
}
Is this viable?
I got this working adding the following to the JSON:
"customFields": {
"textCustomFields": [{
"value": "salesforceId",
"required": "false",
"show": "false",
"name": "DSFSSourceObjectId"
}
]
},

How to create Signature Request with DocuSign for HTML format?

I have it working for PDF and now want to try an HTML document. I am using the method of POSTing a JSON object containing the document bytes base64 encoded. The only examples I find online are using the multipart/form-data method but I would much prefer to just POST a JSON object w/ the document base64 encoded like I did for PDF. Perhaps I need to encode the HTML differently from how I encoded the PDF?
"errorCode": "ANCHOR_TAG_PROCESSING_FAILURE",
"message": "An Error Occurred during anchor tag processing. Invalid document"
Here's the JSON I am POSTing:
{
"recipients": {
"signers": [
{
"email": "my.email#gmail.com",
"name": "Dummy test",
"recipientId": 1,
"tabs": {
"dateSignedTabs": [{
"anchorString": "signer1date",
"fontSize": "Size12",
"name": "Date Signed",
"recipientId": "1",
"tabLabel": "date_signed"
}],
"fullNameTabs": [{
"anchorString": "signer1name",
"fontSize": "Size12",
"name": "Full Name",
"recipientId": "1",
"tabLabel": "Full Name"
}],
"signHereTabs": [
{
"anchorString": "signer1sig",
"name": "Please sign here",
"optional": "false",
"recipientId": "1",
"scaleValue": 1,
"tabLabel": "signer1sig"
}
]
}
}
]
},
"emailSubject": "Dummy Test Request a signature via email",
"documents": [
{
"documentId": "1",
"name": "index.html",
"documentBase64": "PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZCBsYW5nPSJlbiI+Cjx0aXRsZT5Eb2N1c2lnbiBUZW1wbGF0ZTwvdGl0bGU+CjwvaGVhZD4KPGJvZHk+CgoJPGgxPlRyYWRlIEFzc2lnbm1lbnQgQWdyZWVtZW50PC9oMT4KCTxoNCBpZD0iRGF0ZWRBc09mIj5mZWFmPC9oND4KCTxoNCBpZD0iQmV0d2VlbiI+ZmVhZjwvaDQ+Cgk8aDQgaWQ9ImFuZCI+ZmVhZjwvaDQ+CgkKCTxwPnNpZ25lcjFkYXRlPC9wPgoJPHA+c2lnbmVyMW5hbWU8L3A+CgoKPC9ib2R5Pgo8L2h0bWw+"
}
],
"status": "sent"
}
According to the documentation there is a node for fileExtension, when not default (PDF), I believe this needs to be explicitly set.
https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/

Create DocuSign Envelope with Custom Fields

I am trying to add custom fields at the envelope level via the REST API and cannot get the values to be retained. The custom fields have been defined in the UI and come over in the envelope, but without the value that was assigned. If I add a custom field that was not defined in the UI, then it does not come over at all.
If I add the new custom field in a second call after the envelope is initially created, it will work, but that seems extraneous. What am I doing wrong?
Here is the JSON for creating a new custom field in the envelope:
{
"emailSubject": "Please Print, Complete and Sign Document",
"emailBlurb": "Please print and complete documents and sign on paper. ",
"status": "sent",
"customFields": {"textCustomFields":[{"name":"MyOwnField","required":"true","show":"true","value":"MyValue"}]},
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"requireSignOnPaper": "true",
"name":"Millard Fillmore",
"email":"dgilbert#firstallied.com",
"recipientId": "1",
"routingOrder": "1"
}]
}
}],
"document":
{
"documentId": "1",
"name": "Corestone Account Application.pdf",
"transformPdfFields": false
}
}]
}
The customFields object needs to be located inside the inlineTemplate object. Try this instead:
{
"emailSubject": "Please Print, Complete and Sign Document",
"emailBlurb": "Please print and complete documents and sign on paper. ",
"status": "sent",
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"customFields": {
"textCustomFields": [{
"name": "MyOwnField",
"required": "true",
"show": "true",
"value": "MyValue"
}]
},
"recipients": {
"signers": [{
"requireSignOnPaper": "true",
"name": "Millard Fillmore",
"email": "dgilbert#firstallied.com",
"recipientId": "1",
"routingOrder": "1"
}]
}
}],
"document": {
"documentId": "1",
"name": "Corestone Account Application.pdf",
"transformPdfFields": false
}
}]
}