Skip to content

Private.API

Nikhil Mashettiwar edited this page Jun 25, 2015 · 17 revisions

Namespace: Private

Private

Private DoucSign API

Source:

Methods

<static> _getTokenEndpoint(baseUrl, action) → {*}

Constructs the URL necessary for token management. Internal function that should not be called.

Parameters:
Name Type Description
baseUrl string

DocuSign API base URL.

action string

Action for API calls.

Source:
Returns:
Type
*

<static> addUsers(apiToken, baseUrl, usersToAdd, callback)

Creates a set of new users in DocuSign for the Org associated to the base URL

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

usersToAdd object[]

Array of Objects with account creation information.

usersToAdd[].first string

First Name

usersToAdd[].last string

Last Name

usersToAdd[].email string

Email Address

usersToAdd[].password string

Password

callback function

Returned in the form of function(response).

Source:

<static> deleteUsers(apiToken, baseUrl, usersToDelete, callback)

Deletes a set of users from DocuSign

Parameters:
Name Type Description
apiToken string

DS API OAuth2 access token.

baseUrl string

DS API base URL.

usersToDelete array

Collection of users in the form of {userId: userId}

callback function

Returned in the form of function(response).

Source:

<static> exports.generateNewGuid() → {string}

Creates guids for use with when creating new users

Source:
Returns:
Type
string

<static> exports.getAPIToken(email, password, callback)

getAPIToken wraps both getLoginInformation and getOauthToken to return a single object containing the oAuth Token and baseUrl for future calls. This is mostly a convenience function.

Parameters:
Name Type Description
email string

Email address of the DocuSign user.

password string

Password of the DocuSign user.

callback function

Returned in the form of function(err, response).

Source:

<static> exports.getApiUrl() → {string}

Provides an environment specific URL for the highest level API calls

Source:
Returns:
Type
string

<static> exports.getHeaders(token) → {Object}

Formats and return an authorization header with the given oAuth token

Parameters:
Name Type Description
token
Source:
Returns:
Type
Object

<static> exports.getLoginInfo(email, password, callback)

Gets login information for the default account/organization.

Parameters:
Name Type Description
email string

Email address of the DocuSign user.

password string

Password of the DocuSign user.

callback function

Returned in the form of function(err, response).

Source:

<static> exports.getOauthToken(email, password, baseUrl, callback)

Gets an oAuth Token for given username & password that can be used to access the DocuSign API on subsequent calls instead of using the password repeatedly.

Parameters:
Name Type Description
email string

Email address of the DocuSign user.

password string

Password of the DocuSign user.

baseUrl string

DocuSign API base URL.

callback function

Returned in the form of function(err, response).

Source:

<static> exports.makeRequest(apiName, options, logResponse, callback)

Helper function for making web requests to DocuSign

Parameters:
Name Type Description
apiName

name of the API to be requested

options

options for the request

logResponse

flag indicating whether the response object should be echoed to the logs

callback
Source:

<static> exports.sendMultipart(mpUrl, mpHeaders, parts, callback)

This function constructs and sends a multipart request.

mpUrl is a string containing the URL where the multipart request will be made to.

mpHeaders is an object that contains HTTP headers for the whole request. These will be combined with the appropriate Content-Type (CT) header, so providing the CT header is not required.

parts is a list of objects of structure { headers, body } -> where headers is an object of HTTP headers and values. -> where body is a string or Node.js stream object.

Returns into callback with the expected request parameters of structure { error, request, body }.

Parameters:
Name Type Description
mpUrl
mpHeaders
parts
callback
Source:

<static> getConsoleUrl(apiToken, baseUrl, callback)

Gets the DocuSign Embedded Dashboard view

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

callback function

Returned in the form of function(response).

Source:

<static> getEnvelopeInfo(apiToken, baseUrl, envelopeId, callback)

Get information about the specified Envelope.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

envelopeId string

ID of envelope to get documents from.

callback function

Returns the envelope information in a JSON object. Returned in the form of function(response).

Source:

<static> getEnvelopeList(apiToken, baseUrl, fromDate, callback)

Gets a list of envelopes that have been created starting from the designated date to the present.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

fromDate string

Date string.

callback function

Returned in the form of function(err, response).

Source:

<static> getEnvelopes(apiToken, baseUrl, envelopeType, doFullRetrieval, callback)

Get information about envelopes for the account with the given apiToken.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

envelopeType string

The type of envelope to get. Valid values are 'all', 'awaiting_my_signature', 'out_for_signature', 'completed', and 'drafts'.

doFullRetrieval boolean

If true, retrieve all envelopes of the given envelopeType. Otherwise, only get the first 50 most recent envelopes.

callback function

Returns envelope info that is in response.folderItems.

Source:

<static> getInfo(apiToken, baseUrl, userId, callback)

Get user info for a given user.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

userId string

DocuSign userId.

callback function

Returned in the form of function(response).

Source:

<static> getOrgAccountInfo(accountId, apiToken, callback)

Gets the account info for the given org accountId

Parameters:
Name Type Description
accountId string

DocuSign AccountId.

apiToken string

DocuSign API OAuth2 access token.

callback function

Returned in the form of function(response).

Source:

<static> getPlan(apiToken, baseUrl, callback)

Get the billing plan info for DS account with the given apiToken.

Adds custom properties to plan object before sending it to the callback envelopesLeft - calculated name - shortcut for planName which is redundant plan.planName. :)

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

callback function

Returned in the form of function(response).

Source:

<static> getRecipients(apiToken, baseUrl, envelopeId, callback)

Get a list of recipients for a given envelopeId.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

envelopeId string

ID of envelope to get list of recipients from.

callback function

Returns the list of recipients in the form of function(response).

Source:

<static> getSignature(apiToken, baseUrl, userId, callback)

Gets the user signature.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

userId string

DocuSign UserId.

callback function

Returned in the form of function(err, response).

Source:

<static> getSignedDocuments(apiToken, baseUrl, envelopeId, encoding, attachCertificate, callback)

Get all the signed documents that were in the given envelope.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

envelopeId string

ID of envelope to get documents from.

encoding string

Node.js buffer encoding for the returned value. Pass null for binary or base64 for Base64 encoding.

attachCertificate boolean

A flag to decide whether or not to attach the Certificate of Completion (CoC) into the returned PDF.

callback function

Returns the PDF file buffer in the given encoding. Returned in the form of function(response).

Source:

<static> getSignerView(apiToken, baseUrl, userId, clientUserId, envelopeId, returnUrl, callback)

Get the URL for the Embedded Signing View.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

userId string

DocuSign userId.

clientUserId string

This is required if the signer is an offline signer.

envelopeId string

ID of envelope to get documents from.

returnUrl string

URL you want the Embedded View to return to after you have signed the envelope.

callback function

Returns the PDF file buffer in the given encoding. Returned in the form of function(response).

Source:

<static> getSocialConnection(apiToken, baseUrl, userId, callback)

Gets social connection details for a given user.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

userId string

DocuSign UserId.

callback function

Returned in the form of function(response).

Source:

<static> getTemplates(apiToken, baseUrl, callback)

Gets the templates for a given account

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

callback function

Returned in the form of function(response).

Source:

<static> getTemplateView(apiToken, baseUrl, templateId, returnUrl, callback)

Creates an envelope from a template, and then obtains a view of the newly created envelope for the envelope sender.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

templateId string

ID of template you wish to create an envelope from.

returnUrl string

URL you want the Embedded View to return to after you have tagged the envelope.

callback function

Returns the Embedded Sending View created from the template. Returned in the form of function(response).

Source:

<static> getUserList(apiToken, baseUrl, callback)

Returns a list of users for the organization in the base URL

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

callback function

Returned in the form of function(response).

Source:

<static> getView(apiToken, baseUrl, action, fullName, email, files, returnUrl, event, callback)

Wrapper function that is designed for high convenience scenario where you have all information up front about what action user wants to do with the documents, the list of documents & their buffers, etc

Pass all of that in this convenience function and the API handles both creating the envelope and getting the embedUrl for the DocuSign envelope configuration view of the document

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

action string

The DS process to use. Valid values are: sign - Only the user signs the envelope. send - Recipients selected by the user sign the envelope. both - The user and selected recipients sign the envelope.

fullName string

The full name of the user.

email string

The email address of the user.

files object[]

A list of file objects to be uploaded into DS.

Properties
Name Type Description
name string

The name of the file.

extension string

The extension of the file (e.g. pdf).

url string

The URL to download from.

base64 string

The base64-encoded buffer of the file. contents (files[].url does not need to be set).

returnUrl string

The URL to be redirected to after the DS process is done.

event object

An object with values concerning what happens after the DS process is done (e.g. webhook registration). Can be null.

Properties
Name Type Description
platform string

The name of the calling app.

recipients object

Mirrors DS API Recipients structure (note that recipientId will be filled in by this function).

showSignAndReturn boolean

A flag to control whether or not to show the Sign & Return popup after the user signs.

eventNotification object

This object mirrors the structure of the event notification request in the DS API.

callback function

Returns the response body from DS API (this also includes an additional envelopeId field). Returned in the form of function(response).

Source:

<static> revokeOauthToken(token, baseUrl, callback)

Revoke the given DocuSign OAuth2 token.

Parameters:
Name Type Description
token string

The DocuSign OAuth2 token to revoke.

baseUrl string

DocuSign API base URL.

callback function

Returned in the form of function(err, response).

Source:

<static> searchThroughEnvelopes(apiToken, baseUrl, searchTerm, callback)

Search DS envelopes with the given searchTerm.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL..

searchTerm string

The term that the DS API should search for.

callback function

Returns the list of envelopes matching the search term.

Source:

<static> sendEnvelope(apiToken, baseUrl, recipients, emailSubject, files, callback)

Request a Signature on a Document.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

recipients JSON

JSON object with recipient information. For more information on how to construct a recipient object please visit: https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Recipient Parameter.htm

emailSubject string

Subject of the email sent for the envelope created.

files object[]

A list of file objects to be uploaded into DS.

files[].name string

The name of the file.

files[].extension string

The extension of the file (e.g. pdf).

files[].url string

The URL to download from.

files[].base64 string

The base64-encoded buffer of the file

callback function

Returns the PDF file buffer in the given encoding. Returned in the form of function(response).

Source:

<static> sendTemplate(apiToken, baseUrl, emailSubject, templateId, templateRoles, callback)

Request Signature via Template.

Parameters:
Name Type Description
apiToken string

DocuSign API OAuth2 access token.

baseUrl string

DocuSign API base URL.

emailSubject string

The Email Subject of the Envelope created from the Template you wish to send.

templateId string

ID of template you wish to create an envelope from.

templateRoles array

Array of JSON objects of templateRoles. For more information please visit: https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST API References/Send an Envelope from a Template.htm%3FTocPath%3DREST%2520API%2520References%7C_39

callback function

Returns JSON object with envelope information. Returned in the form of function(response).

Source:

Generated with wicked.
Clone this wiki locally