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

Bulk Operations

Most collection endpoints — Job.Structure.Nodes, Job.Structure.Members, the load primitives, and so on — expose two shapes:

  • Single: Nodes.PostAsync(NodeCreate body) — one entity per call
  • Bulk: Nodes.Bulk.PostAsync(List<NodeCreate> body) — many entities per call

Differences

SingleBulk
Round tripsOne per itemOne per batch
ValidationEach item is validated as the call arrivesThe full batch is validated up front, before any items are created
Failure responseThrows on the first failing itemReturns a *BulkResult with Succeeded and Errors lists
Partial commit on validation failureItems submitted before the failure are already createdNothing is created unless every item validates
Partial successNot applicableOpt-in via ?continueOnError=true

Example: creating 100 nodes

Bulk endpoints accept a List<XCreate> and return an XBulkResult with the created entities under Succeeded and any failures under Errors. BulkError.Index is the position in the input list, so you can match an error back to the body you sent.

var bodies = Enumerable.Range(0, 100) .Select(i => new NodeCreate { X = i % 10, Y = 0, Z = i / 10 }) .ToList(); var result = await client.Job.Structure.Nodes.Bulk.PostAsync(bodies); foreach (var node in result!.Succeeded!) { Console.WriteLine($" Node {node.Id}: ({node.X}, {node.Y}, {node.Z})"); } foreach (var error in result.Errors!) { Console.WriteLine($" [{error.Index}] {error.Error}"); }

The same pattern applies to Job.Structure.Members, Job.Structure.Sections, and the load primitives — every collection endpoint has a .Bulk counterpart.

Partial success with continueOnError

A bulk POST is all-or-nothing by default — if any item fails validation, nothing is created and the call returns errors. Pass continueOnError=true to commit every item that validates and report the rest in Errors:

var result = await client.Job.Structure.Nodes.Bulk.PostAsync( bodies, config => config.QueryParameters.ContinueOnError = true); Console.WriteLine($"Succeeded: {result!.Succeeded!.Count}"); Console.WriteLine($"Failed: {result.Errors!.Count}");

When to use bulk

  • Creating or updating more than one entity in a single script or automated job.
  • Importing or replicating a model from another source.
  • Anywhere you'd otherwise loop a single-item call.
Last modified on