Skip to main content

Bridge.Request

Allows making api authorized requests within deck content.

.get(url[, options])

GET data from an endpoint

ParameterTypeDescription
urlStringRequired url to retrieve data from. If the endpoint begins with /api/, it will use a LivePreso API endpoint
optionsObjectOptional extra options
options.queryObjectOptional 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.

ParameterTypeDescription
urlStringRequired url to POST data to. If the endpoint begins with /api/, it will use a LivePreso API endpoint
dataAnyAn optional blob of data to send with the POST
optionsObjectOptional extra options
options.queryObjectOptional 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.

ParameterTypeDescription
urlStringRequired url to PUT the data update to. If the endpoint begins with /api/, it will use a LivePreso API endpoint
dataAnyAn optional blob of data to send with the PUT
optionsObjectOptional extra options
options.queryObjectOptional 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.

ParameterTypeDescription
urlStringRequired url to DELETE data from. If the endpoint begins with /api/, it will use a LivePreso API endpoint
optionsObjectOptional extra options
options.queryObjectOptional 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.

ParameterTypeDescription
contactIDsnumber[] | nullA 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"
]
}
]
}
note

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.

ParameterTypeDescription
signingBackendStringThe key of the signing backend to use
optionsObjectOptional extra options
options.contactIDsnumber[] or nullA list of contact IDs on the appointment that need to sign the document
options.choicelistobject[] or nullA 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"
}