Account
Earned badges
Achievement: Latest Unlocked
Replies
Topics Started
Preferences
Topic Started
Topics |
---|
I am creating a package with a pdf file and JSON Payload with Package status as 'SENT'. It is creating the Packae successfully in Postman. |
Replies Created
Reply to: Issue with Package creation usinf Salesforce Apex Rest API
Wednesday, April 10, 2024 at 08:53amHi Duo,
I am using Restful API with my own HTTP request. If I give the Status as "Draft" it is working as expected but not showing the record in UI of Onespan Sandbox.
Below is my code for reference
String jsonBody = '{"documents": [{"id": "MyDocumentID", "fields": [{"value": "22/01/2024","name": "RequestDate"}, {"value": "Boston Scientific","name": "CompanyName"}, {"value": "200 E MAIN ST","name": "Address"}, {"value": "400 E MAIN ST","name": "BillTo"}, {"value": "400 E MAIN ST","name": "ShipTo"}, {"value": "BSC","name": "NewCustomerName"}, {"value": "John Smith","name": "ContactName"}, {"value": "Boston Scientific","name": "BillingName"}, {"value": "[email protected]","name": "NewCustomerEmailAddress"}, {"value": "[email protected]","name": "NewBillingEmailAddress"}, {"value": "200 E MAIN ST,\\nPHOENIX AZ, 85123 USA","name": "CurrentShipTo"}, {"value": "There are changes in my Org \\nPHOENIX AZ, 85123 USA","name": "Explanation"}], "extract": true, "extractionTypes": ["TEXT_TAGS"], "name": "Sample Contract"}], "type": "PACKAGE", "status": "DRAFT", "roles": [{"id": "Signer1", "index": 0, "type": "SIGNER", "signers": [{"email": "[email protected]", "firstName": "John", "lastName": "Smith", "signerType": "EXTERNAL_SIGNER"}], "name": "Signer1"}], "name": "Field Injection Example V2-1", "settings": {"ceremony": {"handOver": {"text": "Back to Join", "title": "Click here to go back to Join", "href": "https://www.google.com", "autoRedirect": true, "parameters": ["PACKAGE", "SIGNER", "STATUS"]}}}}';
// Construct the boundary for multipart form data
String boundary = 'xx---------webkit';
String delimiter = '\r\n--' + boundary + '\r\n';
String closeDelimiter = '\r\n--' + boundary + '--';
// Construct the request body for multipart form data
String requestBody = delimiter;
requestBody += 'Content-Disposition: form-data; name="file"; filename="staticRes.pdf"\r\n';
requestBody += 'Content-Type: application/pdf\r\n\r\n';
requestBody += staticRes.Body+ '\r\n';
requestBody += delimiter;
requestBody += 'Content-Disposition: form-data; name="payload"\r\n\r\n';
requestBody += jsonBody + '\r\n';
requestBody += closeDelimiter;
// Send the request to create the package
HttpRequest request = new HttpRequest();
request.setEndpoint('https://sandbox.esignlive.com/api/packages');
request.setMethod('POST');
request.setHeader('Authorization', 'Bearer ' + accessToken);
request.setHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
request.setBody(requestBody);
HttpResponse response = new Http().send(request);
And I also have one doubt is Apex SDK a Paid service or a Free resource?
Reply to: Issue with Package creation usinf Salesforce Apex Rest API
Wednesday, April 10, 2024 at 11:28pmHi Duo,
May I know how much time the Access token is valid it is saying "expiresAt": 1712749843263 How can we calculate this time? and is there any way to get rid of this after the signing URL is generated? If the user fails to sign the agreement then there is no way for him to sign and it is asking for the access.
FYI we are not sending the mail for the agreement sign but we are opening the URL in the new tab with the click of a button.
Divya.
Reply to: Issue with Package creation usinf Salesforce Apex Rest API
Thursday, April 11, 2024 at 08:57amHi Duo,
Thanks for clarifying But I can see the below error when I kept the Agreement open for some time. Is this the expected behavior?
Subscriptions
Topics | Replies | Freshness | Views | Users |
---|---|---|---|---|
I am creating a package with a pdf file and JSON Payload with Package status as 'SENT'. It is creating the Packae successfully in Postman. |
6 | 1 month ago | 40 |