Show All Workspaces
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.The available Stimulsoft Server workspaces can be listed through either the strongly-typed .NET Connect API or the raw REST API.
Via the .NET Connect API.
How it works. Both APIs authenticate as a supervisor and enumerate workspaces, so you can integrate with the Server from .NET or any HTTP client.
Via the .NET Connect API.
var connection = new StiServerConnection(ServerAddress);
connection.Accounts.Users.Login(Username, Password);
if (connection.Accounts.Roles.Current.IsSupervisor)
{
var names = connection.Accounts.Workspaces.FetchAll().Select(w => w.Name);
}
connection.Accounts.Users.Logout();Via the REST API.var login = WebRequest.Create($"{RestUrl}/login");
login.Headers.Add("x-sti-UserName", Username);
login.Headers.Add("x-sti-Password", Password);
var sessionKey = GetResponseJson(login).Value<string>("ResultSessionKey");
var req = WebRequest.Create($"{RestUrl}/workspaces");
req.Headers.Add("x-sti-SessionKey", sessionKey);
var names = GetResponseJson(req).Value<JArray>("ResultWorkspaces").Select(w => w["Name"]);StiServerConnection— the .NET API;Accounts.Workspaces.FetchAll()returns the workspaces after login.- The REST API logs in with
x-sti-UserName/Passwordheaders, then calls/workspaceswith thex-sti-SessionKey.
How it works. Both APIs authenticate as a supervisor and enumerate workspaces, so you can integrate with the Server from .NET or any HTTP client.