CommitTransaction

Commit a BUL transaction against the head Version of a Node, producing a new Version

POST
/openapi/ifc/CommitTransaction

Applies one or more BUL (BIM.works Update Language) statements to the given Version and creates a new Version on the same Node. The given Version must be the head (latest) Version of its Node: history is linear, and committing against an older Version fails with 409. The commit is atomic (either the complete new Version is created, or nothing is) and synchronous: the new Version is ready when the call returns.

Statements: SET <feature> = <value>, ... WHERE <bql>, DEL <feature>, ... WHERE <bql>, DELETE OBJECT WHERE <bql>, and TRANSFORM MOVE(x, y, z) ROTATE(AXIS(x, y, z), angle, PIVOT(x, y, z)) WHERE <bql> — a rigid world-space move and/or rotate of the matched products' placements (coordinates default to mm with an optional length unit, angles in degrees; at least one of MOVE/ROTATE is required, the PIVOT defaults to each object's placement origin). Objects placed relative to a transformed object move with it.

The value of a SET is a literal, or a feature of each object, SET quantity.BaseQuantities.NetVolume = calculated.quantity.netVolume WHERE ...: read per object from the given Version (never from what an earlier statement of the transaction wrote) and converted like a literal with its unit; an object without that value is left alone.

GEOREFERENCE CRS "EPSG:<code>" ORIGIN (e, n, h) XAXIS (abscissa, ordinate) | ROTATION <degrees> [GRIDSCALE g] [CRSDESCRIPTION "..."] [GEODETICDATUM "..."] [VERTICALDATUM "..."] [MAPPROJECTION "..."] [MAPZONE "..."] writes the model's georeference into its IFC data: an IfcMapConversion with an IfcProjectedCRS (map unit the CRS's own, usually the metre) on the 3D 'Model' context, created or overwritten. ORIGIN is the map position of the model's origin, in metres unless a length unit is given; XAXIS is the direction of the model's X axis in the map, ROTATION the same as an angle counter-clockwise from east. The CRS must be a projected EPSG system (a system in feet gets a foot map unit), and the model IFC4 or later (convert an IFC2X3 model with CONVERT SCHEMA TO IFC4 first). The new Version's stored geo reference is computed from the written conversion. GEOREFERENCE REMOVE deletes the conversion. Neither takes a WHERE.

With dry_run: true the statements are resolved and applied in memory only. Nothing is persisted, and the response reports per update how many objects the WHERE clause matches and how many of those would actually change (a SET to a value an object already has is matched but not changed). Dry runs work against any Version, not only the head; is_head in the response tells whether a real commit would be accepted. With include_oids: true as well, every update also names its statement (statement_index, statement_lines) and the objects themselves: matched_oids and changed_oids, for showing them before committing.

Requires write access to the Node. For scoped tokens, the token's tasks must include CommitTransaction. Every statement other than CONVERT SCHEMA and GEOREFERENCE also needs the user feature BUL (Model editing), dry runs included: without it the call answers 403 USER_FEATURE_REQUIRED.

Try it#

Edit the request and send it; it runs against this instance with your token, and the examples follow the form.

Authorization
Bearer <auth token>
Content-Type
application/json
Body
1 2 3 4 5 6 7
Authorization: Bearer <auth token>
Content-Type: application/json
Accept: application/json
curl -X POST "$BIMWORKS_URL/openapi/ifc/CommitTransaction" \
  -H "Authorization: Bearer $BIMWORKS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "version_uuid": "BIM_WORKS_FIRST_MODEL",
  "bul": [
    "SET attribute.Name = \"Standard door\" WHERE type = IFCDOOR"
  ],
  "comment": "Normalize door names"
}'
Send to see the response

Examples#

curlshell
curl -X POST "$BIMWORKS_URL/openapi/ifc/CommitTransaction" \
  -H "Authorization: Bearer $BIMWORKS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "version_uuid": "BIM_WORKS_FIRST_MODEL",
  "bul": [
    "SET attribute.Name = \"Standard door\" WHERE type = IFCDOOR"
  ],
  "comment": "Normalize door names"
}'

The examples are complete programs in the OpenAPI SDKs, all in the same four steps. The method in each SDK's reference: Java · .NET · TypeScript · PHP · Python.

Request body#

CommitTransactionRequest · application/json

FieldTypeDescription
version_uuiduuidrequiredThe UUID of the Version to apply the transaction to. Must be the head Version of its Node (dry runs excepted)
bularray of stringrequiredThe BUL statements to apply, in order, as one atomic transaction
commentstringoptionalA description of the intent of the transaction, stored with the transaction and shown in the Version history
dry_runbooleanoptionalWhen true, the updates are resolved and applied in memory only and the response reports what a commit would do, without persisting anything Default false.
include_oidsbooleanoptionalDry run only. When true, every update in the response also carries statement_index, statement_lines, matched_oids and changed_oids Default false.

Responses#

StatusSchemaDescription
200CommitTransactionResultThe transaction result. For a commit: transaction and node. For a dry run: updates, is_head and (only when the Version is not the head) head_version
400ErrorResponseInvalid input: a missing or invalid argument, an invalid query/identifier/path, a state conflict caused by the request (for example a Node name that already exists), or an uploaded file that was rejected because it cannot be read (type for example INVALID_INPUT_FILE, NO_CONVERTIBLE_CONTENT or one of the StepParserErrorCode codes; uploading the same file again fails the same way)
401ErrorResponseAuthentication failed: the bearer token is missing, malformed, expired or otherwise invalid, or the provided login credentials are incorrect
403ErrorResponseAuthenticated, but not allowed: no read/write rights on the target Node, the token's task or IP scope does not allow this call, or a required user feature is missing
404ErrorResponseThe referenced entity (Node, Version, model file, upload, ...) does not exist
409ErrorResponseThe request conflicts with the current state: for example a transaction commit against a Version that is no longer the head of its Node
429ErrorResponseToo many requests from this client in a short time, on an installation that limits the request rate. Wait the number of seconds in Retry-After before trying again
500ErrorResponseAn unexpected server-side error (database, routing, IO, unknown)
503ErrorResponseBIM.works is temporarily unavailable: it is restarting, stopped, or down for scheduled maintenance (type SERVICE_UNAVAILABLE or MAINTENANCE). Wait the number of seconds in Retry-After before trying again
504ErrorResponseBIM.works did not respond in time (type REQUEST_TIMED_OUT). The request may still be completed: check its result before trying again
Generated from api.yml·openapi.json