Unofficial wrapper for the Sakai
API
$ npm install sakai-api
Before you can take any actions you need to be authenticated
.
const SakaiAPI = require("sakai-api").default;
(async () => {
const API = new SakaiAPI();
await API.login({ username: "xxx", password: "xxx" });
})();
const SakaiAPI = require("sakai-api").default;
(async () => {
const API = new SakaiAPI();
await API.login({ username: "xxx", password: "xxx" });
const siteId = "xxx"; // <---- site id
let announcement = await API.getSiteAnnouncement(siteId);
console.log(announcement.data);
})();
const SakaiAPI = require("sakai-api").default;
(async () => {
const API = new SakaiAPI();
await API.login({ username: "xxx", password: "xxx" });
const siteId = "xxx"; // <---- site id
let assignment = await API.getSiteAssignment(siteId);
console.log(assignment.data);
})();
Any unsuccessful action will throw an error. If you want to mitigate that you need to catch it.
const SakaiAPI = require("sakai-api").default;
(async () => {
const API = new SakaiAPI();
try {
await API.login({ username: "xxx", password: "xxx" });
const siteId = "xxx"; // <---- site id
let assignment = await API.getSiteAssignment(siteId);
console.log(assignment.data);
} catch (e) {
console.log(e)
}
})();
SakaiAPI
Initialize new SakaiAPI.
Param | Type | Description |
---|---|---|
config.baseUrl | String |
Baseurl - your institution's url |
Returns the extracted meaning from a sentence, based on the context.
Param | Type | Description |
---|---|---|
params.username | String |
Username |
params.password | String |
Password |
Gets announcement for a specific site
Param | Type | Description |
---|---|---|
siteId | String |
Site ID |
Gets all announcement for current user
Gets assignments for a specific site
Param | Type | Description |
---|---|---|
siteId | String |
Site ID |
Gets an assignment
Param | Type | Description |
---|---|---|
assignmentId | String |
Assignment ID |
Gets all assignments for current user
Gets calendar for a specific site
Param | Type | Description |
---|---|---|
siteId | String |
Site ID |
Gets all calendars for current user
Gets calendar event for a specific site
Param | Type | Description |
---|---|---|
params.siteId | String |
Site ID |
params.eventId | String |
Event ID |
Gets sites for current user
Gets content for a specific site
Param | Type | Description |
---|---|---|
siteId | String |
Site ID |
Gets content for current user