Using Solibri with REST API

Solibri includes a REST-API starting in version 9.10.3. It can be used, for example to:

  • Send an IFC file to Solibri
  • Update IFC in Solibri
  • Send components to Solibri Selection Basket
  • Get BCF content from Solibri

The API is aimed to enable real-time communication between CAD tools and Solibri running on the same desktop computer. The API works with all variations of Solibri (Solibri Office, Solibri Site, and Solibri Anywhere).

Creating a client

Solibri REST api has been specified using OpenAPI. Depending on the programming language you are using, there's most likely a way to automatically generate a client for the API. To create the API, you need to have the yaml file that is available here. API generation tools can be found here and here.

Launching Solibri

To activate the REST API, Solibri needs to be launched with special command line arguments:

Name Arguments Description Example
--rest-api-server-portport number Open Solibri with REST API in the given port number--rest-api-server-port=10876
--rest-api-server-local-content Show local content, like full paths for opened model, instead just model name
--rest-api-server-http Launch Solibri with http connection instead of https

Examples:

"C:\Program Files\Solibri\SOLIBRI\Solibri.exe" --rest-api-server-port=10876 --rest-api-server-local-content --rest-api-server-http

Finding out Solibri installation directory

In Windows, all Solibri installation paths can be found in the registry key: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Solibri\SMC\home

In Mac OS, Solibri is typically installed in /Applications/Solibri

Displaying swagger UI

When Solibri is launched with the REST API, you can see the API with a browser by opening the browser on localhost in the port specified in the command line. For example, http://localhost:10876/solibri/v1/

With the swagger UI, you can view the API and try out its functionality.

Verifying that Solibri REST API is responding

The REST API has a trivial GET /ping service that can be used to check the connection. This service always returns pong.

Checking Solibri version

The GET /about endpoint shows the product type (Solibri Office, Solibri Site, or Solibri Anywhere) that is running, as well as the version of the software.

Checking the status of the running Solibri instance

By calling the GET /status endpoint, you can get information about:

  • busy: Boolean flag telling whether Solibri is busy, for example, still importing or checking
  • filename: file to which the Solibri project is saved (.smc file path)
  • status: Status of the file. One of:
  • NO_FILE: No file is open
  • UNSAVED: Model is open, but not saved yet
  • SAVED: Model is saved
  • MODIFIED: Model has been modified since last saved

Sending an IFC file

A new IFC file is sent to POST /models endpoint. The required name parameter is the human-readable name for the model. The IFC file itself is sent in the body of the request. The response to this request contains the UUID that Solibri assigns to the model.

Model metadata

Model metadata refers to the key value pairs of strings. Metadata can contain, for example, information about the model identifier and version that have been sent from the CAD tool.

You can set model metadata with PUT /models/{modelUUID}/metadata/{metadataKey} endpoint, where modelUUID is the UUID of the model and metadataKey is the key of the metadata.

You can retrieve model metadata with GET /models/{modelUUID}/metadata/{metadataKey} endpoint.

Sending partial IFC update

Solibri REST API supports updates with partial IFC files. A partial IFC file is a full IFC file containing modified components and the components to which these components are directly related. It also has the full containment structure (project, site, storey, ...).

The partial model update is sent to the PUT /models/{modelUUID}/partialUpdate endpoint.

Deleting model components

Since partial updates have only information about modified components, the components that are deleted need to be sent separately using the POST /models/{modelUUID}/deleteComponents endpoint. The modelUUID specifies the model from which the components need to be deleted, and the body is a list of IFC guids of the components to delete. For example:

[
  "1M8KH1NYZOHON6gGbspwpA",
  "07l5H2yVBHHg4bGn9wGoRX"
]

Sending a full IFC update

If the sending CAD tool doesn't support partial IFC updates, or the version information the CAD tool has stored in the metadata, it is possible to send a full IFC update with the PUT /models/{modelUUID}/update endpoint.

Selection Basket

Solibri Selection Basket is used to communicate selected components between the CAD tool and Solibri. For example, if the user wants to fix a problematic component, they can put it in the Selection Basket and ask for the Selection Basket content in the CAD tool, that can then select/highlight the selected component.

Selection Basket is accessed with these endpoints: * GET /selectionBasket: gets the content of the Selection Basket as a list of guids. * POST /selectionBasket: sets the content of Selection Basket. This takes a list of guids in the body.

Info

The POST /info/{guid} service highlights and shows the information of the component whose guid is given as the parameter.

BCF-XML

With the GET /bcfxml/{version} endpoint it is possible to get BCF content from Solibri. BCF content is created from issues in the Presentation view. The endpoint has the following parameters:

  • version: The BCF-XML version. One of:
  • one: BCF-XML 1.0
  • two: BCF-XML 2.0
  • two_one: BCF-XML 2.1
  • scope: limits the issues returned:
  • all: (default) returns all issues
  • selected: Issues selected in the Issues view
  • marked: Issues marked in the Issues view

3D Camera

Solibri 3D Camera API is used to get the current state of the camera and control the camera by setting a new state. The camera state consist of camera location, direction and projection mode .

3D Camera is accessed with these endpoints: * GET /threed/camera: gets the 3D camera state. * POST /threed/camera: sets the 3D camera state.

Opening and saving a Solibri project

Opening existing Solibri projects can be done via the project endpoint. The POST request requires the project name and binary contents as input. So usually the client would need to read the file contents from file system and send it in the request.

Saving a Solibri project can be done via the project/persist endpoint. The POST request requires file system location where the project is to be saved as an input parameter.