Last active
January 31, 2022 09:32
-
-
Save saurav28/3f8e073946d7f3482ce1258264ec717c to your computer and use it in GitHub Desktop.
Script to connect to SDM using CmisJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//sample script to connect to SAP Document Managment using cmisjs | |
// https://github.com/agea/CmisJS | |
var cmis = require('cmis'); | |
//Pre-requisite is to create a service instance of SDM and onboard a repository. | |
// SDM api endpoint will be provided in VCAP | |
var session = new cmis.CmisSession('<server url>'); | |
//fetch the token progmatically using the UAA token endpoint | |
session.setToken('< access token>').loadRepositories() | |
.then(function(){ | |
return session.query("select * from cmis:document", false) | |
}) | |
.then(function(data) {console.log(data); | |
//change the default repository such that the subsequent APIs execute against the changed repository | |
var keys = Object.keys(session.repositories); | |
session.defaultRepository = session.repositories[keys[1]]; | |
var result = session.query("select * from cmis:document", false); | |
result.then((data => console.log(data))) | |
}) | |
.catch(err => console.log(err)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment