Create a new VerdocsEndpoint to call Verdocs platform services.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
Optional
options: VerdocsEndpointOptionsThe current user session, or null if not authenticated. May be either a User or Signing session. If set, the
presence of the document_id
field can be used to differentiate the types. Only signing sessions are associated
with Envelopes.
Clear the active session.
Clear the active signing session.
Get the current base URL. This should rarely be anything other than 'https://api.verdocs.com'.
Get the current environment.
Get the current session type.
Load a persisted session from localStorage. Typically called once after the endpoint is configured when the app or component starts.
Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
endpoint.logRequests(true);
Subscribe to session state change events.
Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
endpoint.setBaseURL('https://api.verdocs.com');
Set the Client ID for Verdocs API calls.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
endpoint.setClientID('1234);
Set the operating environment. This should rarely be anything other than 'verdocs'.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
endpoint.setEnvironment('verdocs-stage');
Set the session type. In general this should be done immediately when the endpoint is created. Changing the session type may be done at any time, but may have unintended consequences if the endpoint is shared between multiple widgets.
Changing the session type will clear/reload the action session. This may trigger notifications to session state observers. Apps that use observers to trigger UI updates such as logging the user out should be prepared to handle this event.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
endpoint.setEnvironment('verdocs-stage');
Set the timeout for API calls in milliseconds. 5000-20000ms is recommended for most purposes. 15000ms is the default. Note that some calls may involve rendering operations that require some time to complete, so very short timeouts are not recommended.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
endpoint.setTimeout(3000);
Set the authorization token that will be used for Verdocs API calls. This will also set the session metadata and notify any listeners of the new data.
If this Endpoint will be used for non-default purposes (e.g. signing, or in an alternate environment) those settings should be made before calling this. Sessions are persisted to localStorage, and the environment and type become part of the storage key.
import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
const endpoint = new VerdocsEndpoint();
endpoint.setToken(accessToken);
Static
get
VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs. Endpoints can be used for isolated session tasks.
For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user. In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then discarded once signing is complete.
Note that endpoint configuration functions return the instance, so they can be chained, e.g.