🤖 New in SPACE GASS 14.51 — the MCP server lets your AI agent build, analyse and design your models. Get started →
SpaceGass API
Recipes

Switch to readonly mode

The API runs in readwrite mode by default, holding a full SPACE GASS license seat. If you only need to query results, switch to readonly mode to release the seat — freeing it for the desktop application or another API instance.

Readonly mode must be set before opening a job. If a job is already open, you must close it first — the mode switch is queued until the job closes.

Switch to readonly, open, query, close

The snippet below switches to readonly, opens a sample project, queries node reactions from a previous analysis, then closes the job. Because the mode was set before opening, the API never acquires a SPACE GASS license seat.

using SpaceGassApi; using SpaceGassApi.Models; var client = SpaceGassApiClient.CreateClient("http://localhost:34560"); // Switch to readonly before opening — no SPACE GASS seat consumed await client.Service.AccessMode.PostAsync( new AccessModeUpdate { AccessMode = AccessMode.ReadOnly }); try { await client.Job.OpenSample.PostAsync( new OpenSampleRequest { FileName = "Portal Frame.SG" }); // Query existing analysis results (read-only operations only) var reactions = await client.Job.Query.Analysis.Static.NodeReactions.GetAsync(); foreach (var r in reactions!.Results!) { Console.WriteLine($"Node {r.Node}, LC {r.LoadCase}: Fy={r.Fy:F2} kN"); } } finally { await client.Job.Close.PostAsync(); // Restore readwrite when finished await client.Service.AccessMode.PostAsync( new AccessModeUpdate { AccessMode = AccessMode.ReadWrite }); }

What if a job is already open?

If you call POST /service/access-mode with "ReadOnly" while a job is open, the API returns 202 Accepted — the transition is queued and commits when the job closes. Close the job first if you need the mode to take effect immediately.

If all license seats are in use when switching back to readwrite, the API returns 409 Conflict and stays in readonly.

Check the current mode

Use GET /service/access-mode (the accessMode and pendingAccessMode fields) to see the active mode and any pending transition.

See also

Last modified on