Back to top

Getting Workspaces

Last modified Mar 31, 2016
   No tags assigned

With the documentation of the SC REST API in hand, and with a SocioCortex Server running at https://server.sociocortex.com , you can already perform several operation to the SocioCortex resources. In fact, you can get the list of all workspaces with the REST API call “/workspaces/”. Similarly you can get the list of groups (“/groups/”), users (“/users/”), MxL autocompletion hints without specifying a context (“/mxlAutoCompletionHints/”) and list of search hints for a given prefix (“/searchHints/”). These operations would work anonymously, and also in your browser: https://server.sociocortex.com/api/v1/workspaces

When working on an AngularJS-based web client, you can also use sc-angular https://github.com/sebischair/sc-angular which wraps the access to the REST API and furthermore provides some convenience functions. Each method accessing SocioCortex's REST API returns a respective promise, which can be handled by the then-function and a respective callback method. To get a list of all workspaces with sc-angular, simply inject the scData service in your AngularJS application and use it as follows:

scData.Workspace.query().then(function (workspaces) {
	for (var i = 0; i < workspaces.length; i++) {
		console.log(workspaces[i].name);
	}
}); 

To get a particular workspace, simply use the following REST operation: https://server.sociocortex.com/api/v1/workspaces/workspaceId Analogously, when using sc-angular, you can use the get-function of the respective resource type.

Challenge

It is time for your first task. Complete the code below to get the workspace with id 107yhdgc7q9u6 and output the name to the console. When your code is ready, just press run.

// Hint: You should use console.log() to output to the console

(function(){

user input expected

})();

Northwind

Files and Subpages

There are no subpages or files.