- 06 Dec 2022
- 1 Minute to read
- Print
- DarkLight
- PDF
Overview
- Updated on 06 Dec 2022
- 1 Minute to read
- Print
- DarkLight
- PDF
The Liquit Workspace API allows you to integrate the content in Liquit Workspace with your Portal. The Liquit Workspace API contains JavaScript functions which allow you to communicate with the Liquit Workspace backend.
Audience
This documentation is designed for people familiar with JavaScript programming and object-oriented programming concepts. You should also be familiar with Liquit Workspace from a user's point of view.
Loading the Liquit Workspace API
To start using the Liquit Workspace API you need to include the Liquit Workspace API javascript file found on api.liquit.com. In the head of your HTML file you should include it as follows:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Liquit Workspace API</title>
<script type="text/javascript" src="https://api.liquit.com/workspace/v2/liquit.workspace.js"></script>
</head>
<body>
</body>
</html>
The URL contained in the script tag is the location of a JavaScript file that loads all of the functions and definitions you need for using the Liquit Workspace API. This script tag is required.
Hello world
The easiest way to get learning about the Liquit Workspace API is to see a simple example, the following webpage outputs all available applications in Liquit Workspace in your web console:
// Initialize Liquit API with the target zone.
Liquit.Initialize('https://workspace.liquit.com', {
});
Liquit.SSO({
// Username of the user to login,
// it's recommended for best experience to set this property to the expected user as it will be used for example as login hint to Azure AD.
username: null,
// Identity Source to use, will auto-detect if not set.
identitySource: null //'Azure AD'
}, function(sessionId, fault) {
// Check if authentication failed.
if (fault != null) {
alert('Error ' + fault.code + ': ' + fault.message);
return;
}
// Fetch the applications that are available to the end user at the current context.
Liquit.Applications.List({
sort: 1
}, function (fault, result) {
// Check if the request failed.
if (fault != null) {
alert('Error ' + fault.code + ': ' + fault.message);
return;
}
console.log(result);
});
});