SpringCM Node.js REST API SDK
This SDK currently provides a limited feature set, as it was created and is developed primarily for internal IT work at Stria.
Accessing the REST API requires you create an API user in your SpringCM account and assign a client ID to that user in the REST API section of Account Preferences. Once set, you can use the API by providing the client ID and corresponding secret. The client ID and client secret are provided by SpringCM's support staff on request. For more information, visit this webpage.
Examples
Below are a few usage examples. Be sure to check the tests folder for more examples.
SpringCM Client
Connect
Before you can interact with your SpringCM account, you need to connect via the SpringCM client.
const SpringCM = ; // Create a new clientvar springCm = clientId: 'your_client_id' clientSecret: 'your_client_secret' dataCenter: 'uatna11' // na11, na21, etc.; springCm;
Disconnect
Once you are done using the SpringCM client, you should close the connection, especially if your program is going to close immediately. Closing the connection ensures all queued requests and operations are completed.
Comments shown below are only applicable when execution reaches that line, i.e. comment #3 occurs after #2.
// 1) Queue up 10 requests then immediately call close()springCm; // 2) Requests can no longer be submitted. Most operations will return an error.
Folders
Root folder
springCm;
Subfolders
springCm;
Get folder by path
springCm;
Get folder by UID
If you'll know the UID of a folder beforehand, you can reference it by this UID.
springCm;
Subfolder pages
If you have a folder with a large number of subfolders, you may want to use paging. To do so, pass an options object as the second argument instead of the callback.
springCm;
Create a folder
You can create a new folder, or retrieve an existing folder by setting the
exclusive
option. By default, all folder creation is exclusive, meaning
the operation will fail if the folder already exists. Note that this only
applies to the base folder, i.e. creating /Contracts/ACME, Inc
with
exclusive
set to true
will succeed even if /Contracts
already exists.
// Creates only if the folder doesn't exist by defaultspringCm; // Get the folder if it already existsspringCm;
Upload document to a folder
springCm;
Documents
Get document by path
springCm;
Get document by UID
springCm;
Download document
springCm; // or springCm;
Delete document
springCm;
Move document
You can reference the source document and target folder by path, UID, or with an existing object of the corresponding type, e.g.
springCm; springCm; springCm;
Query CSV data
springCm;