zeeshanshanif

Create Package with documents and fields

0 votes
Hi, I want to upload document on package, document uploading working fine. I also want to add roles and approvals through code. I have added payload in this way but it is not working. "payload": path.join(__dirname, 'payload.json') Please help me how it is possible var options = { method: 'POST', url: 'https://sandbox.esignlive.com/api/packages/{packageId}/documents', headers: { authorization: 'Basic ==========================================='' }, formData: { 'files[]': { value: buffer, options: { filename: "testing", contentType: "multipart/form-data", "payload": path.join(__dirname, 'payload.json') } } } Also is it possible to create package + document + approvals + roles together?

Reply to: Create Package with documents and fields

0 votes
What language are you trying to use the REST API in?

- Michael

Director, Partner and Developer Technologies, OneSpan

Facebook - Twitter - LinkedIn


Reply to: Create Package with documents and fields

0 votes
Sorry I forgot to write. I am using Nodejs

Reply to: Create Package with documents and fields

0 votes
Have you seen this blog by Haris? https://www.esignlive.com/blog/esignlive-how-to-creating-a-simple-node-js-web-application/

- Michael

Director, Partner and Developer Technologies, OneSpan

Facebook - Twitter - LinkedIn


Reply to: Create Package with documents and fields

0 votes
Thanks mwilliams. I have tried above link . It is working fine. It is showing values that already filled by user in form, but currently user can not fill in the document . I have 2 condition: 1) send package to users with the boxes(textfield etc), so he can fill the document in iframe. 2) send package to users with the boxes(textfield etc), and the values already filled , but editable , so he can remove the value and filled new value .

Reply to: Create Package with documents and fields

0 votes
After adding approvals, it is working fine, now users can edit the document. "documents": [{ "approvals": [{ "role": "Signer1", "fields": [{ "value": fields.lastName, "name": "last_name", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }] }] }] But If I use other pdf sample, package creates but now field is showing here is pdf sample I uses

Attachments
workform.pdf195.18 KB

Reply to: Create Package with documents and fields

0 votes
Meaning when you use a different document than that which comes with the example?

- Michael

Director, Partner and Developer Technologies, OneSpan

Facebook - Twitter - LinkedIn


Reply to: Create Package with documents and fields

0 votes
yes In the example shared in the link(Haris example, ). when I fill the form, all the values are placed in the document with respect to their names. I am confuse on this point too. But when I use different document (I attached in previous reply) , document showing without values(same as in the attachment).

Reply to: Create Package with documents and fields

0 votes
You might look at the document from Haris's example and the form names used inside of it and how they coincide with the JSON payload from the example. See the attached images of the document names from Haris's PDF document. Let me know if I'm misunderstanding the issue. :)

- Michael

Director, Partner and Developer Technologies, OneSpan

Facebook - Twitter - LinkedIn


Attachments
form1.png23.62 KB
form2.png10.79 KB

Reply to: Create Package with documents and fields

0 votes
How these values placed , because in jsonPayload you didn't tell fields width, height, top and bottom, so when eSignLive document opens, how lastname placed infront of lastname , city infront of city etc. i am confused in this point. Here are fields "documents": [{ "approvals": [ { "role": "Signer1", "fields": [ { "value": '', "name": "first_name", "type": "INPUT", "subtype": "TEXTFIELD" }, { "value": fields.lastName, "name": "last_name", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.address, "name": "address", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.city, "name": "city", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.zip, "name": "zip", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.state, "name": "state", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.country, "name": "country", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.phoneNumber, "name": "phone_number", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.emailAddress, "name": "email", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.company, "name": "company", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }, { "value": fields.policyNumber, "name": "policy_number", "type": "INPUT", "subtype": "TEXTFIELD", "extract": true }] }], "name": "Sample Contract", "id": "contract", "extract": true }],

Attachments
fielPNG.png22.74 KB

Reply to: Create Package with documents and fields

0 votes
The way it works in the example that Haris did was to use document extraction. The size of the field is already defined because the field was created within the PDF. For example, you can use Adobe Acrobat to create a PDF form with specific names for each field. In the images I posted above, that is the PDF from Haris's example, opened from Acrobat. You can see the names of the fields and I could edit them if necessary. So, in your example of the fields you have, you'd need to edit your PDF document to have form fields placed where you want them and the size you want them, named the same as the ones in your JSON. You should see this if you compare the "form1" and "form2" images I posted above with the JSON payload used in Haris's example. I can help you set your document up with form fields to test, if there is still confusion. Just let me know.

- Michael

Director, Partner and Developer Technologies, OneSpan

Facebook - Twitter - LinkedIn


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off