Retrieve fields from a template for binding

0 votes

Hello Team,

I'm working on the use case below and was wondering if you could help ! 

Use Case: We have an existing template with some documents and fields on it and we want to retrieve those fields to bind some values on them. 

My question : Are we able to call the API in order to retrieve fields that are on a template (and not a package) ? 

I did check the API reference and there is a call to retrieve fields from an existing package but it only retrieving one field so I'm not sure how we would get the others preferably from the template but also from a draft package as a work around I would appreciate your help !

Approved Answer

Reply to: Retrieve fields from a template for binding

0 votes

Hi Zakaria,


Thanks for your post!

Do you want to populate different field values upon the clone call when creating transaction out of this template, or is it more of a one-time thing?

If the former, you can directly inject field value in the clone call by passing field values at "documents" array > "approvals" array > "fields" array > filter field by its id/name, and set "value" attribute. I shared an example JSON in this previous post.

If the latter:
#1 Get the entire template JSON via:
GET /api/packages/{template_id}

And carry this request header - "Accept" : "application/json; esl-api-version=11.52"

#2 Loop through the "documents" array > "approvals" array. For examples there are 3 approvals, update the field values in these 3 approvals via 3 PUT calls:

PUT /api/packages/{template_id}/documents/{documentId}/approvals/{approvalId}

with the modified JSON node of these 3 approvals respectively.





Duo Liang OneSpan Evangelism and Partner Integrations Developer

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