Click or drag to resize
Using The API

The Workspaces .NET SDK provides classes for the previously-noted resources which include Authentication, Files, Workspaces, Users, and Organizations, in addition to others. These resource classes provide methods that allow access to their functionality.

In general, most of the methods often require a JSON object that represents the data the resource method needs. Successful requests will generally return a string, JSON object or Stream(e.g. when downloading documents) to indicate that the requested action has been successfully performed. A common JSON object returned is the BulkOperationResultJson that provides details on the success of each operation or any problem(s) encountered.

Here's a simple example that illustrates those ideas. It uses an instance of ApiSession class to start a service account session for a given user. StartSessionWithServiceAccount method of Apisession requires the user's email address for which the service account has been created, the issuer(an ID created when the service account is created), the token expiration in minutes,and the certificate. It will return a "Success" LoginResult if the session starts successfully.The ApiSession then sends a request , to one of the getters to the resources, to get an instance of a resource. In the following code sample, the listRoomsV30 of workspaces object gets back an iterable JSON object representing a list of WorkspaceInfoJson(with each item inside representing a workspace).

C#
ApiSession apiSession = new ApiSession(serverUrl);

Workspaces workspaces = apiSession.GetWorkspacesResource();

LoginResult loginResult =
    apiSession.StartSessionWithServiceAccount(username,
                                              serviceAccount,
                                              expiresInMinutes,
                                              certificate);

ItemListJson<WorkspaceInfoJson> itemListJson = workspaces.listRoomsV30(workspaceTypes);

Many domain-specific errors will result in a WebException being returned to the caller. More-generalized C# errors like Exception are also possible.

Examples for using the Workspaces resource and other resources can be found in the Examples section.