Bridge.Request
Allows making api authorized requests within deck content.
.get(url[, options])
GET data from an endpoint
Parameter | Type | Description |
---|---|---|
url | String | Required url to retrieve data from. If the endpoint begins with /api/ , it will use a LivePreso API endpoint |
options | Object | Optional extra options |
options.query | Object | Optional query parameters to pass to the end of the URL |
Returns:
Returns a bluebird Promise. See bluebird for more information.
// GET URL would be /api/endpoint/?name=Bob
await Bridge.Request.get("/api/endpoint/", { query: { name: "Bob" } })
.create(url[, data, options])
POST to an endpoint, with optional message data.
Parameter | Type | Description |
---|---|---|
url | String | Required url to POST data to. If the endpoint begins with /api/ , it will use a LivePreso API endpoint |
data | Any | An optional blob of data to send with the POST |
options | Object | Optional extra options |
options.query | Object | Optional query parameters to pass to the end of the URL |
Returns:
Returns a bluebird Promise. See bluebird for more information.
await Bridge.Request.create(
"/api/endpoint/",
{ name: "Bob" },
{ query: { id: "1234" } }
)
.update(url[, data, options])
PUT to update an endpoint, with optional message data.
Parameter | Type | Description |
---|---|---|
url | String | Required url to PUT the data update to. If the endpoint begins with /api/ , it will use a LivePreso API endpoint |
data | Any | An optional blob of data to send with the PUT |
options | Object | Optional extra options |
options.query | Object | Optional query parameters to pass to the end of the URL |
Returns:
Returns a bluebird Promise. See bluebird for more information.
await Bridge.Request.update(
"/api/endpoint/",
{ name: "Bob" },
{ query: { id: "1234" } }
)
.delete(url[, options])
DELETE from an endpoint, with optional message data.
Parameter | Type | Description |
---|---|---|
url | String | Required url to DELETE data from. If the endpoint begins with /api/ , it will use a LivePreso API endpoint |
options | Object | Optional extra options |
options.query | Object | Optional query parameters to pass to the end of the URL |
Returns:
Returns a bluebird Promise. See bluebird for more information.
await Bridge.Request.delete("/api/endpoint/", { query: { id: "1234" } })
.availableSignatureBackends([contactIDs = null])
Fetches the available signature backends for the given contact IDs. If no contact IDs are passed in, uses all contacts.
Parameter | Type | Description |
---|---|---|
contactIDs | number[] | null | A list of contact ids |
Returns:
Returns a bluebird Promise. See bluebird for more information.
// Explicit
await Bridge.request.availableSignatureBackends([1,2,3])
// All contacts
await Bridge.request.availableSignatureBackends()
Example response:
{
"available": [
{
"key": "manual",
"title": "Manual Signature"
},
{
"key": "docusign",
"title": "DocuSign"
}
],
"unavailable": [
{
"key": "xplan",
"title": "Iress Digital Signature",
"errors": [
"User is not connected to Xplan"
]
}
]
}
You can retrieve contact IDs from Bridge.Envs.get("contacts")
.requestSignature(signingBackend[, options])
Begins the signing process. Only available if signing is enabled for the presentation.
Parameter | Type | Description |
---|---|---|
signingBackend | String | The key of the signing backend to use |
options | Object | Optional extra options |
options.contactIDs | number[] or null | A list of contact IDs on the appointment that need to sign the document |
options.choicelist | object[] or null | A list of objects containg theurl and visibility keys |
Returns:
Returns a bluebird Promise. See bluebird for more information.
// A docusign signature, for all contacts to sign. The document will contain all
// slides in the presentation
await Bridge.request.requestSignature("docusign")
// A docusign signature, for one contact to sign. The document will contain all
// slides in the presentation
await Bridge.request.requestSignature("docusign", {
contactIDs: [1]
})
// A docusign signature, for all contacts to sign. The document will contain a subset
// of slides in the presentation
await Bridge.request.requestSignature("docusign", {
contactIDs: [1],
choicelist: [
{ "url": "https://yourserver/api/deckversion/1/", "visible": true },
{ "url": "https://yourserver/api/sections/1/", "visible": false },
{ "url": "https://yourserver/api/sections/2/", "visible": true },
{ "url": "https://yourserver/api/slides/1/", "visible": true },
]
})
Example response:
{
"id": 1,
"url": "https://yourserver/api/signingrequests/44/",
"snapshot": "https://yourserver/api/snapshots/2617/",
"choicelist": [
{ "url": "https://yourserver/api/deckversion/1/", "visible": true },
{ "url": "https://yourserver/api/sections/1/", "visible": false },
{ "url": "https://yourserver/api/sections/2/", "visible": true },
{ "url": "https://yourserver/api/slides/1/", "visible": true },
],
"created_by": "https://yourserver/api/users/6/",
"signing_backend": "docusign",
"original_document": null,
"signed_document": null,
"signed_date": null,
"signer_set": [
{
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"contact": "https://yourserver/api/contacts/1/",
"backend_config": ""
}
],
"status": "creating"
}