nareshishere | Posts: 74

access a document which created in sandbox

0 votes
can we able to create the template in sandbox UI and send the created template through Rest Api.

Duo_Liang | Posts: 3776

Reply to: access a document which created in sandbox

0 votes
Hi nareshishere, Yes, you can create the template through UI and then clone a package from this template and send it, through REST API. To do so, you'd (1) get the template ID from the dashboard URL:
https://sandbox.esignlive.com/a/template/GpdUhlZv9oDunPVRA_7MnYPHr9A=
The slug indicates the template ID (2) To clone a package from this template, and send it at the same time: HTTP Request
POST /api/packages/{templateId}/clone
HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key
Request Payload
{
  "status" : "SENT"
}
Response Payload
{
    "id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI="
}
Few notes: (1) you can clone and send the package within the same API call (2) you can override package level settings by adding more attributes in the payload (3) if you have placeholder signer (guide here) involved in your template, you need to replace the placeholder with actual signer information, in this payload Check the Create Package From Template guide for more detailed instructions. Duo

nareshishere | Posts: 74

Reply to: access a document which created in sandbox

0 votes
how to get the placeholder id , i have created a placeholder Signer1 in sandbox.

Duo_Liang | Posts: 3776

Reply to: access a document which created in sandbox

0 votes
Hi nareshishere, Placeholder/signer created from UI will be randomly given an ID, therefore you can either invoke an extra API to lookup the ID, or you can manually check the ID and hard code it, by below steps: (1) log onto your web UI (2) hit this link:
https://sandbox.esignlive.com/api/packages/{your_template_id}
, the template related information should be returned in JSON (3) format the JSON and find the "roles" array, check the role named "Signer1" and you will find the role ID there, which normally looks like below:
    {
      "id": "753564c2-76bc-4bcf-8a16-b9b6473dcbd1",
      "specialTypes": [],
      "locked": false,
      "emailMessage": {
        "content": ""
      },
      "reassign": false,
      "deliverDocumentsByEmail": false,
      "attachmentRequirements": [],
      "index": 0,
      "type": "SIGNER",
      "data": null,
      "signers": [],
      "name": "Signer1"
    }
Duo

nareshishere | Posts: 74

Reply to: access a document which created in sandbox

0 votes
Thanks it worked now its saying { "code": 400, "messageKey": "error.validation.sendPackage.noApprovals", "message": "Cannot send package without approvals.", "name": "Validation Error" } It seems like i did not added signature field . How to inject the signature field through Rest api

Duo_Liang | Posts: 3776

Reply to: access a document which created in sandbox

0 votes
Hi nareshishere, Since you are using template and the placeholder signer, you can do the design through UI, and the cloned packages will inherit the layout from template. Duo

nareshishere | Posts: 74

Reply to: access a document which created in sandbox

0 votes
say If i adding text field in pdf how to inject value from Rest api

Duo_Liang | Posts: 3776

Reply to: access a document which created in sandbox

0 votes
Hi nareshishere, If you were talking about the "Field Injection" feature -- use PDF forms as location and stamp values to the document before signing, it's not feasible by using template, because the field injection can only be performed once when the document first upload to the server. Because of this limitation, you may want to upload the document(s) with injected field values every time you cloned a package, then apply the "Layout" to each document. If you don't want to upload documents every time (store the documents in the template), you have to use the OneSpan Sign label field (because it's a type of OneSpan Sign field, unless you were using automatic extraction methods like text tags, you don't use the PDF form to map the field but through UI, label field will be stamped to the PDF after signing). In this case, you have to clone a template, then update the label field values, and send the package, in different API calls. Both workarounds include extra steps, so have a try on both approaches and let me know which path you want to follow. Tell me if I've misunderstood your use case. Duo

nareshishere | Posts: 74

Reply to: access a document which created in sandbox

0 votes
The scenario is different . I already created a label field through sandbox . Just need to pass values from Rest api . I need to understand how to pass values from Rest APi for the labels created through the sandbox .

Duo_Liang | Posts: 3776

Reply to: access a document which created in sandbox

0 votes
Hi there, To update the label field values, you need to: (1)retrieve the package JSON, parse, loop through and find the field JSON of your interest:
GET /api/packages/{packages}
If you knew the specific document ID or approval ID, you can use below API instead:
GET /api/packages/{packages}/documents/{documentID}
GET /api/packages/{packages}/documents/{documentID}/approvals/{approvalID}
(2) Change the values of the fields. (3.1) If you only have few fields to update, you can update them one by one by below API, with the updated field JSON as payload:
PUT /api/packages/{packageId}/documents/{documentId}/approvals/{signatureId}/fields/{fieldId}
(3.2) If you want to update fields under the same signature in bulk, you'd update the whole signature/approval:
PUT /api/packages/{packageId}/documents/{documentId}/approvals/{signatureId}/
Keep the signature JSON intact as the payload and only change the field value attribute. Both 3.1 or 3.2 required to pass in the complete field/signature JSON, partial metadata will cause information lost. Duo

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