DocumentHub user-defined APIs
DocumentHub ships with several user-defined APIs, which you can use to integrate DocumentHub into your own applications, scripts, or automated workflows:
- SLC-DH-UDAPI-ManageBuckets: Allows you to list, create, update, and delete document buckets.
- SLC-DH-UDAPI-ManageFiles: Allows you to list, upload, and delete files inside a bucket.
- SLC-DH-UDAPI-ManageDomSources: Allows you to list, create, update, and delete DOM sources.
- SLC-DH-UDAPI-ManageSharepointSources: Allows you to list, create, update, and delete SharePoint configurations.
- SLC-DH-UDAPI-Read-DomModules: Allows you to list the DOM modules that are available on the DataMiner System.
- SLC-DH-UDAPI-ReadDomDefinitions: Allows you to list the DOM definitions of a given DOM source.
- SLC-DH-UDAPI-DownloadFile: Allows you to download a file from a bucket.
- SLC-DH-UDAPI-GetAgentVersion: Allows you to retrieve the installed version of the DocumentHub Assistant. Note that this feature is currently still in preview.
For an example of how you can authenticate requests to these APIs, refer to the tutorial Managing buckets with the DocumentHub user-defined APIs. To find the route used as the public URL segment of each API, check the value defined in the User-Defined APIs module in DataMiner Cube.
Tip
For the full source code of these scripts, go to the DocumentHub Solution repository on GitHub (look for projects starting with SLC-DH-UDAPI-*).
Handling of unsupported methods
Each DocumentHub UDAPI script only supports a specific set of HTTP methods. If you send a request using a method that is not supported (for example, PATCH on SLC-DH-UDAPI-ManageBuckets), the script's default branch returns an HTTP 400 status code with a message listing the supported methods.
Depending on how the user-defined API is configured in Cube, DataMiner Cube may reject the method before the script runs, in which case an HTTP 405 status code is returned instead. Both response codes indicate the same thing: the method you used is not supported.
Managing buckets
Bucket management is done using the SLC-DH-UDAPI-ManageBuckets API. For details, refer to the tutorial Managing buckets with the DocumentHub user-defined APIs.
Managing files
Use the SLC-DH-UDAPI-ManageFiles API to list, upload, and delete files inside a bucket. It supports the GET, POST, and DELETE methods.
To list files, send a
GETrequest. Optionally, provide a filter in the request body, for example:{ "bucketId": "", "filter": "", "storageType": "Local" }- Omit
bucketIdto search across all buckets. filtermatches against the file name or path.storageTypenarrows the search to buckets of a given storage type (only applied whenbucketIdis not provided).
The response contains, per bucket, the total number of matching files and their details (name, path, size, creation date, etc.).
- Omit
To upload a file, send a
POSTrequest with the following body:{ "bucketId": "", "filePath": "C:\\Temp\\example.pdf", "name": "" }Note
filePathis a path on the DataMiner Agent that executes the script, not a path on your local machine. Make sure the file is present there before calling the API.nameis optional; if omitted, the file name is derived fromfilePath. File names must be unique within a bucket.To delete a file, send a
DELETErequest with the following body:{ "bucketId": "", "fileId": "" }fileIdcan be the file's raw reference, its file name, or its display name. Deleting files is currently only supported for buckets with storage typeLocal.
Managing DOM sources
Use the SLC-DH-UDAPI-ManageDomSources API to list, create, update, and delete the DOM sources that DocumentHub uses to store DOM attachments on a network share. It supports the GET, POST, PUT, and DELETE methods.
To list DOM sources, send a
GETrequest. Optionally, pass a text filter (matched against the name or module) in the request body, or*to return all DOM sources.To create a DOM source, send a
POSTrequest with a body similar to the following:{ "Name": "", "Module": "", "NetworkSharePath": "\\\\server\\share", "username": "", "password": "" }Modulemust reference an existing, unused DOM module (see Listing DOM modules).usernameandpasswordare the network credentials used to access the share, and are required when creating a DOM source.To update a DOM source, send a
PUTrequest with the same body as for creation, including theIdentifierof the DOM source you want to update.usernameandpasswordare optional; if omitted, the existing credential is kept.To delete a DOM source, send a
DELETErequest with the DOM source name as the raw request body (as a JSON string, e.g.,"My DOM source").Note
A DOM source cannot be deleted while it is still linked to a bucket. Unlink it from any buckets first.
Managing SharePoint sources
Use the SLC-DH-UDAPI-ManageSharepointSources API to list, create, update, and delete SharePoint configurations. It supports the GET, POST, PUT, and DELETE methods, following the same pattern as Managing DOM sources.
To list SharePoint configurations, send a
GETrequest. Optionally, pass a text filter (matched against the name, site URL, document library name, or status) in the request body, or*to return all configurations.To create a SharePoint configuration, send a
POSTrequest with a body similar to:{ "Name": "", "SiteURL": "https://yourtenant.sharepoint.com/sites/yoursite", "DocumentLibraryName": "Documents", "TenantID": "", "ClientID": "", "ClientSecret": "" }TenantIDandClientIDmust be valid GUIDs. For more information about these values, go to Configuring SharePoint as a storage backend.To update a SharePoint configuration, send a
PUTrequest with the same body as for creation, including theIdentifierof the configuration you want to update.To delete a SharePoint configuration, send a
DELETErequest with the configuration name as the raw request body.Note
A SharePoint configuration cannot be deleted while it is still linked to a bucket. Unlink it from any buckets first.
Listing DOM modules
Use the SLC-DH-UDAPI-Read-DomModules API to list the DOM modules that are available on the DataMiner System. It only supports the GET method.
When you send the GET request, optionally, you can pass a text filter (matched against the module ID) in the request body, or * to return all modules.
The response will contain a JSON array of modules, each indicating whether it is already in use by an existing DOM source (InUse). To create a DOM source, an unused module is needed, as each module can only be linked to one DOM source.
Reading DOM definitions
Use the SLC-DH-UDAPI-ReadDomDefinitions API to list the DOM definitions of a given DOM source. It only supports the GET method.
Retrieve the identifier of the DOM source by first listing DOM sources.
Send a
GETrequest with the identifier (GUID) of the DOM source as the raw request body.The response will contain a JSON array of DOM definitions, each with an
IDand aName.
Downloading a file
Use the SLC-DH-UDAPI-DownloadFile API to download a file from a bucket to the DataMiner Agent that executes the script. It only supports the POST method.
To download a file, send a POST request with the following body:
{
"BucketId": "",
"FileName": ""
}
FileName is the storage-specific file name or path, as returned by listing files.
The response should contain an HTTP 200 status code and a JSON body similar to the following:
{
"Success": true,
"TempFilePath": "C:\\Skyline DataMiner\\Documents\\DocumentHub\\Temp\\{guid}_example.pdf"
}
Note
TempFilePath is a path on the DataMiner Agent, not on your local machine. The file is written to a fixed temporary folder (C:\Skyline DataMiner\Documents\DocumentHub\Temp) using a unique, generated file name.
Retrieving version information
Note
The Assistant feature is currently still in preview.
Use the SLC-DH-UDAPI-GetAgentVersion API to retrieve the installed version of the DocumentHub Assistant, as recorded in the Solution Registration DOM. It only supports the GET method and requires no request body.
The response should contain an HTTP 200 status code and a JSON body similar to the following:
{
"Success": true,
"Solution": "DocumentHub.Assistant",
"Version": "1.1.2"
}
If no Solution Registration entry is found, the API returns an HTTP 404 status code instead.