zeeshanshanif | Posts: 31

update approvals

0 votes
Hi, I have a package with status draft, Now I want to update an approval using this route PUT /packages/{packageId}/documents/{documentId} /approvals/{approvalId} Here I am updating multiple field values. var options = { method: 'PUT', url: '/packages/{packageId}/documents/{documentId} /approvals/{approvalId}, headers: {'Authorization': APIKey}, body: JSON.stringify({approvals: approvaljson}) }; request(options, callback); But all the time I am getting this error. { "messageKey": "error.internal.default", "message": "Unexpected error. We apologize for any inconvenience this may have caused you, please try again. If the problem persists, please contact our support team.", "code": 500, "name": "Unhandled Server Error" } I am using REST API and Nodejs. Thanks.

Attachments
error.png30.48 KB
harishaidary | Posts: 1812

Reply to: update approvals

0 votes
Hi Zeeshan, Would you be able to share your request payload? Is it something similar to our documentation? http://docs.esignlive.com/content/c_integrator_s_guide/rest_api/approvals.htm#Modify

zeeshanshanif | Posts: 31

Reply to: update approvals

0 votes
Thanks haris. I am giving this json. { id: 'id', role: 'roleId', fields: [ { subtype: 'TEXTFIELD', extract: false, extractAnchor: null, left: 326.9993896484375, top: 390, id: 'id', page: 0, data: null, validation: null, binding: null, width: 269.9996032714844, height: 19.000019073486328, type: 'INPUT', value: 'yes', name: 'lastName' }, { subtype: 'TEXTFIELD', extract: false, extractAnchor: null, left: 329.9997863769531, top: 346.00018310546875, id: 'id', page: 0, data: null, validation: [Object], binding: null, width: 264.9997863769531, height: 22.000028610229492, type: 'INPUT', value: 'no', name: 'firstName' } ] } ------------------------------ var approvaljson= { id: 'id', role: 'roleId', fields: [ { subtype: 'TEXTFIELD', extract: false, extractAnchor: null, left: 326.9993896484375, top: 390, id: 'id', page: 0, data: null, validation: null, binding: null, width: 269.9996032714844, height: 19.000019073486328, type: 'INPUT', value: 'yes', name: 'lastName' }, { subtype: 'TEXTFIELD', extract: false, extractAnchor: null, left: 329.9997863769531, top: 346.00018310546875, id: 'id', page: 0, data: null, validation: [Object], binding: null, width: 264.9997863769531, height: 22.000028610229492, type: 'INPUT', value: 'no', name: 'firstName' } ] } var options = { method: ‘PUT’, url: ‘/packages/{packageId}/documents/{documentId} /approvals/{approvalId}, headers: {‘Authorization’: APIKey}, body: JSON.stringify({approvals: approvaljson}) }; request(options, callback); ---------------- can you please guide me where I am wrong.

harishaidary | Posts: 1812

Reply to: update approvals

0 votes
You are most probably getting that 500 error because you're trying to update a textfield attached to an approval but your target url is incomplete. The PUT /packages/{packageId}/documents/{documentId}/approvals/{approvalId} request is to update the approval itself (e.g. move the position of a capture signature, change the type of signature from capture to initials, etc.). Have a look at our documentation on how to update an field related to an approval: http://docs.esignlive.com/content/c_integrator_s_guide/rest_api/approvals.htm#Update2. Let me know.

zeeshanshanif | Posts: 31

Reply to: update approvals

0 votes
/packages/{packageId}/documents/{documentId}/approvals/{approvalId}/fields/{fieldId} If I do with above route then I have to send separate request for each field. (If I want to update 10 fields or all fields except signature and time) Is there any solution which change 2-3 or all fields of an approval in one request?

harishaidary | Posts: 1812

Reply to: update approvals

0 votes
The way it works in eSignLive is that you either: 1. update an approval with all related fields (i.e. PUT /packages/{packageId}/documents/{documentId} /approvals/{approvalId}) 2. update a specific field related to an approval (i.e. PUT /packages/{packageId}/documents/{documentId}/approvals/{approvalId}/fields/{fieldId}) In your case, you will be looking to update an approval with all related fields. You should also be including the signature when making your request. Here's a sample JSON payload:
{
  "role": "516258b1-0e62-48fd-ba28-1317e010f794",
  "fields": [
    {
      "subtype": "CAPTURE",
      "extract": false,
      "extractAnchor": null,
      "left": 315.33837890625,
      "top": 220.4305877685547,
      "width": 165.32359313964844,
      "height": 36.73851776123047,
      "type": "SIGNATURE"
    },
    {
      "top": 462,
      "left": 529,
      "width": 100,
      "height": 126,
      "page": 0,
      "type": "INPUT",
      "value": null,
      "binding": "{approval.signed}",
      "subtype": "LABEL"
    }
  ]
}

tatternutz | Posts: 24

Reply to: update approvals

0 votes
{{uri}}/packages/{{packageId}}/documents/{{documentId}}/approvals
Performing a PUT multiple times to the above api is overwriting the first PUT. Can I perform multiple PUTs to add additional approvals to a document? Or do I have to PUT once with all my SIGNATUREs?
{
	"role": "Id1",
	"id": "Id1",
	"fields": [
		{
			"top": 145.999,
			"left": 150.60000000000002,
			"subtype": "FULLNAME",
			"width": 252,
			"page": 0,
			"type": "SIGNATURE",
			"height": 36
		}
	]
}
{
	"role": "Id2",
	"id": "Id2",
	"fields": [
		{
			"top": 45.999,
			"left": 93.60000000000001,
			"subtype": "FULLNAME",
			"width": 252,
			"page": 0,
			"type": "SIGNATURE",
			"height": 36
		}
	]
}

tatternutz | Posts: 24

Reply to: update approvals

0 votes

I attempted the suggestion in this thread (https://community.onespan.com/forum/multiple-signature-fields-showing-one) but get an error response. My package has those roles (see info) so I'm not sure what else I am missing.

{
  "messageKey": "error.validation.validateApproval.noRolesOnApproval",
  "message": "No role specified as part of this approval.",
  "code": 400,
  "name": "Validation Error"
}

Request Body

{
  "approvals": [
    {
      "role": "Id1",
      "id":"Id1",
      "signed": null,
      "accepted": null,
      "data": null,
      "fields": [
        {
          "page": 2,
          "subtype": "FULLNAME",
          "width": 252,
          "binding": null,
          "extract": false,
          "extractAnchor": null,
          "left": 150.60000000000002,
          "top": 145.999,
          "validation": null,
          "height": 36,
          "data": null,
          "type": "SIGNATURE",
          "value": ""
        }
      ],
      "name": "Id1"
    },
    {
      "role": "Id2",
       "id":"Id2",
		"signed": null,
      "accepted": null,
      "data": null,
      "fields": [
        {
          "page": 3,
          "subtype": "FULLNAME",
          "width": 252,
          "binding": null,
          "extract": false,
          "extractAnchor": null,
          "left": 93.60000000000001,
          "top": 45.999,
          "validation": null,
          "height": 36,
          "data": null,
          "type": "SIGNATURE",
          "value": ""
        }
      ],
      "name": "Id2"
    }
  ]
}

Package Information

{
    "status": "DRAFT",
    "description": "Package Description",
    "language": "en",
    "roles": [
        {
            "id": "EUsOngubJCUB",
            "emailMessage": null,
            "locked": false,
            "reassign": false,
            "specialTypes": [],
            "attachmentRequirements": [],
            "data": null,
            "index": 0,
            "type": "SENDER",
            "signers": [{
                "group": null,
                "language": "en",
                "signature": null,
                "id": "K1TiGqYmrRE1",
                "delivery": {
                    "provider": false,
                    "download": true,
                    "email": true
                },
                "knowledgeBasedAuthentication": null,
                "auth": {
                    "scheme": "NONE",
                    "challenges": []
                },
                "title": null,
                "external": null,
                "updated": "2017-04-26T22:06:54Z",
                "userCustomFields": [],
                "company": "nCino",
                "email": "[email protected]",
                "firstName": "Rich",
                "lastName": "Bateman",
                "phone": "",
                "professionalIdentityFields": [],
                "data": null,
                "address": null,
                "created": "2017-04-26T22:06:54Z",
                "name": "",
                "specialTypes": []
            }],
            "name": "Owner"
        },
        {
            "id": "Id1",
            "emailMessage": null,
            "locked": false,
            "reassign": false,
            "specialTypes": [],
            "attachmentRequirements": [],
            "data": null,
            "index": 0,
            "type": "SIGNER",
            "signers": [{
                "group": null,
                "language": "en",
                "signature": null,
                "id": "c4a0a00a-ea07-49fa-b345-be5e25fb2adc",
                "delivery": {
                    "provider": false,
                    "download": false,
                    "email": false
                },
                "knowledgeBasedAuthentication": null,
                "auth": {
                    "scheme": "NONE",
                    "challenges": []
                },
                "title": "",
                "external": null,
                "updated": "2017-04-26T22:07:47Z",
                "userCustomFields": [],
                "company": "",
                "email": "[email protected]",
                "firstName": "Sam",
                "lastName": "Iam",
                "phone": "",
                "professionalIdentityFields": [],
                "data": null,
                "address": null,
                "created": "2017-04-26T22:07:47Z",
                "name": "",
                "specialTypes": []
            }],
            "name": "RoleName1"
        },
        {
            "id": "Id2",
            "emailMessage": null,
            "locked": false,
            "reassign": false,
            "specialTypes": [],
            "attachmentRequirements": [],
            "data": null,
            "index": 0,
            "type": "SIGNER",
            "signers": [{
                "group": null,
                "language": "en",
                "signature": null,
                "id": "0c228433-81e0-44b4-9b60-dce2a1283c5a",
                "delivery": {
                    "provider": false,
                    "download": false,
                    "email": false
                },
                "knowledgeBasedAuthentication": null,
                "auth": {
                    "scheme": "NONE",
                    "challenges": []
                },
                "title": "",
                "external": null,
                "updated": "2017-04-26T22:08:16Z",
                "userCustomFields": [],
                "company": "",
                "email": "[email protected]",
                "firstName": "Sam",
                "lastName": "Iam",
                "phone": "",
                "professionalIdentityFields": [],
                "data": null,
                "address": null,
                "created": "2017-04-26T22:08:16Z",
                "name": "",
                "specialTypes": []
            }],
            "name": "RoleName2"
        }
    ],
    "id": "Vaii8A_vSNBqR9uz76A2cxZhPds=",
    "visibility": "ACCOUNT",
    "completed": null,
    "autocomplete": true,
    "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": null,
        "id": "K1TiGqYmrRE1",
        "account": {
            "id": "FDm1dI2SVxk0",
            "created": "2017-03-07T20:12:24Z",
            "updated": "2017-03-07T20:12:23Z",
            "company": {
                "id": "c1VpEjeuJHYR",
                "data": null,
                "address": {
                    "city": null,
                    "address1": null,
                    "address2": null,
                    "country": null,
                    "zipcode": null,
                    "state": null
                },
                "name": "nCino"
            },
            "customFields": [
                {
                    "required": false,
                    "id": "contentVersionId",
                    "translations": [{
                        "description": "",
                        "language": "en",
                        "id": "",
                        "data": null,
                        "name": "contentVersionId"
                    }],
                    "data": null,
                    "value": "",
                    "name": ""
                },
                {
                    "required": false,
                    "id": "externalTransactionId",
                    "translations": [{
                        "description": "",
                        "language": "en",
                        "id": "",
                        "data": null,
                        "name": "externalTransactionId"
                    }],
                    "data": null,
                    "value": "",
                    "name": ""
                }
            ],
            "licenses": [{
                "status": "ACTIVE",
                "transactions": [],
                "paidUntil": "2018-03-07T20:12:24Z",
                "plan": {
                    "group": "",
                    "description": "E-Sign Hundreds of Documents with Unlimited Signers",
                    "id": "sandbox",
                    "features": null,
                    "price": {
                        "amount": 0,
                        "currency": {
                            "id": "USD",
                            "data": null,
                            "name": "US Dollar"
                        }
                    },
                    "original": null,
                    "cycle": "YEAR",
                    "contract": "YEAR",
                    "freeCycles": null,
                    "quotas": [
                        {
                            "scope": "ACCOUNT",
                            "cycle": null,
                            "limit": 5,
                            "target": "SENDER"
                        },
                        {
                            "scope": "SENDER",
                            "cycle": null,
                            "limit": 500,
                            "target": "DOCUMENT"
                        },
                        {
                            "scope": "SENDER",
                            "cycle": null,
                            "limit": 500,
                            "target": "STORAGE"
                        }
                    ],
                    "data": null,
                    "name": "Sandbox"
                },
                "created": "2017-03-07T20:12:24Z"
            }],
            "logoUrl": "",
            "providers": null,
            "data": null,
            "owner": "K1TiGqYmrRE1",
            "name": "Rich Bateman"
        },
        "title": null,
        "external": null,
        "updated": "2017-03-07T20:12:23Z",
        "locked": null,
        "userCustomFields": [],
        "activated": null,
        "company": "nCino",
        "email": "[email protected]",
        "firstName": "Rich",
        "lastName": "Bateman",
        "memberships": [],
        "phone": "+1 512-843-0665",
        "professionalIdentityFields": [],
        "data": {
            "serviceCredentials": "{}",
            "showIntro": false
        },
        "address": null,
        "created": "2017-03-07T20:12:24Z",
        "type": "MANAGER",
        "name": "",
        "specialTypes": [],
        "hasDelegates": false
    },
    "documents": [
        {
            "status": "",
            "description": "Must be accepted and agreed to before starting the signing process.",
            "id": "default-consent",
            "signedHash": null,
            "approvals": [],
            "pages": [
                {
                    "id": "",
                    "height": 1030,
                    "width": 796,
                    "left": 0,
                    "top": 0,
                    "version": 0,
                    "index": 0
                },
                {
                    "id": "",
                    "height": 1030,
                    "width": 796,
                    "left": 0,
                    "top": 0,
                    "version": 0,
                    "index": 1
                }
            ],
            "external": null,
            "extract": false,
            "data": null,
            "index": 0,
            "fields": [],
            "name": "Electronic Disclosures and Signatures Consent",
            "size": 0
        },
        {
            "status": "",
            "description": "Example Description",
            "id": "Document1",
            "signedHash": null,
            "approvals": [],
            "pages": [
                {
                    "id": "",
                    "height": 1030,
                    "width": 796,
                    "left": 0,
                    "top": 0,
                    "version": 0,
                    "index": 0
                },
                {
                    "id": "",
                    "height": 1030,
                    "width": 796,
                    "left": 0,
                    "top": 0,
                    "version": 0,
                    "index": 1
                },
                {
                    "id": "",
                    "height": 1030,
                    "width": 796,
                    "left": 0,
                    "top": 0,
                    "version": 0,
                    "index": 2
                }
            ],
            "external": null,
            "extract": false,
            "data": null,
            "index": 1,
            "fields": [],
            "name": "Example Document",
            "size": 31004
        }
    ],
    "consent": "default-consent",
    "due": null,
    "emailMessage": "[email protected]",
    "limits": null,
    "notarized": false,
    "notaryRoleId": null,
    "settings": {"ceremony": {
        "layout": {
            "header": {
                "feedback": true,
                "breadcrumbs": true,
                "globalActions": {
                    "confirm": true,
                    "download": true,
                    "hideEvidenceSummary": false,
                    "saveAsLayout": true
                },
                "globalNavigation": true,
                "sessionBar": true,
                "titleBar": {
                    "title": true,
                    "progressBar": true
                }
            },
            "footer": null,
            "brandingBar": null,
            "iframe": false,
            "navigator": true
        },
        "events": {"complete": {
            "dialog": true,
            "redirect": null
        }},
        "enforceCaptureSignature": false,
        "declineButton": true,
        "declineReasons": [],
        "disableDeclineOther": false,
        "disableDownloadForUncompletedPackage": false,
        "disableFirstInPersonAffidavit": false,
        "disableInPersonAffidavit": false,
        "disableOptOutOther": false,
        "disableSecondInPersonAffidavit": false,
        "documentToolbarOptions": null,
        "handOver": null,
        "hideCaptureText": false,
        "hideLanguageDropdown": false,
        "hidePackageOwnerInPerson": false,
        "hideWatermark": false,
        "maxAuthFailsAllowed": 3,
        "optOutButton": true,
        "optOutReasons": [],
        "style": null,
        "inPerson": false
    }},
    "signedDocumentDelivery": null,
    "trashed": false,
    "updated": "2017-04-26T22:08:16Z",
    "data": {
        "First Name": "Bill",
        "Last Name": "Johnson",
        "Signing Order": "1",
        "origin": "api",
        "currentSignerProgress": {
            "documentsToConfirmCount": "0",
            "documentsConfirmedCount": "0",
            "approvalsToConfirmCount": "0",
            "approvalsConfirmedCount": "0",
            "documentsPartiallyCompletedCount": "0",
            "approvalsToSignNowCount": "0"
        },
        "overallProgress": {
            "documentsToCompleteCount": "2",
            "documentsCompletedCount": "2",
            "documentsToConfirmCount": "0",
            "documentsConfirmedCount": "0",
            "documentsPartiallyCompletedCount": "0"
        }
    },
    "messages": [],
    "type": "PACKAGE",
    "name": "Package for Test",
    "bulkSendable": false
}

mwilliams | Posts: 957

Reply to: update approvals

1 votes
On your first post, if you want to add them individually, simply change the type of http call from PUT to POST. For your second post, you're getting the error because a PUT to the approvals endpoint doesn't include the "approvals": portion. I'm not even sure this is a useful call to make as this is an update to the entire approvals object in the JSON payload, however, you can only pass a single approval. If you want to do an update to all approvals on a document, back the PUT call down to the document level packages/{packageid}/documents/{documentId} instead. Here, you can pass the {"approvals": [{approval1},{approval2}]} JSON and all will be applied as expected. Hope this helps.

tatternutz | Posts: 24

Reply to: update approvals

0 votes
Thanks Michael, I went with changing my PUT to POST.

mwilliams | Posts: 957

Reply to: update approvals

0 votes
Great! Let us know whenever you have questions! :)

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