OneSpan Sign Developer Community: Week in Review (July 10, 2017)
Let's take a quick look at what happened for the week of July 10th in the OneSpan Sign Developer Community.
Create and Send a Transaction in Node.js
In a previous blog, I went over on how to create a simple web form application in Node.js. Essentially, the blog covered a basic use case where the user is initially asked to complete a form with their information. When the form is submitted, using OneSpan Sign's Field Injection feature, the information is injected onto the document and the user is redirected to a signing session where they can sign the required document. If you simply want an example code on how to make a REST call in order to create and send a transaction in OneSpan Sign, below is a sample Node.js code that does just that.
var fs = require("fs"); var request = require("request"); var options = { method: 'POST', url: 'https://sandbox.esignlive.com/api/packages', headers: { accept: 'application/json; esl-api-version=11.0', authorization: 'Basic api_key', 'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' }, formData: { payload: '{"documents":[{"approvals":[{"id":"ExampleSignatureId","role":"Signer1","fields":[{"page":0,"top":200,"subtype":"LABEL","height":50,"binding":"{approval.signed}","left":100,"width":200,"id":"myLabelField","type":"INPUT","value":"dd/mm/yyyy"},{"page":0,"top":100,"subtype":"FULLNAME","height":50,"left":100,"width":200,"type":"SIGNATURE","name":"ExampleSignatureId"}],"name":""}],"id":"sample-contract","name":"Test Document"}],"status":"SENT","type":"PACKAGE","roles":[{"id":"Signer1","type":"SIGNER","signers":[{"email":"[email protected]","firstName":"John","lastName":"Smith","id":"Signer1"}],"name":"Signer1"}],"name":"Example Package"}', file: { value: 'fs.createReadStream("C:/Users/hhaidary/Desktop/pdfs/doc1.pdf")', options: { filename: 'doc1.pdf', contentType: null } } } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
In order to run the sample code above, you will need the following:
- An OneSpan Sign API key
- Node.js installed
- The request module installed
Default Signature Type
OneSpan Sign's Designer allows you to view each document, add signatures and other fields to it, and assign visibility permissions to the documents. When adding signatures, the default signature type is "FULLNAME". Unfortunately, the default signature type cannot be changed. If this is something you would like to see in a future release of OneSpan Sign, you can post an Enhancement Request. Our product managers regularly follow that forum for suggestions by OneSpan Sign users. If you have questions regarding this blog or anything else concerning integrating OneSpan Sign into your application, visit the Developer Community Forums: developer.esignlive.com. That's it from me. Thank you for reading! If you found this post helpful, please share it on Facebook, Twitter, or LinkedIn.