SDKs

The two families of BIM.works SDKs — the OpenAPI SDKs for Java, .NET, TypeScript, PHP and Python, generated from the OpenAPI document, and the classic hand-written SDKs for JavaScript, Java and .NET — what each covers and which one to use.

BIM.works has two families of SDKs. Both are released with every server version and carry its version number.

OpenAPI SDKs Classic SDKs
Languages Java, .NET, TypeScript, PHP, Python JavaScript, Java, .NET
Made by Generated from the OpenAPI document on every build Written by hand
Calls Exactly the operations of the API part, over HTTPS, one method per operation The task API, the one the BIM.works web application uses, over HTTP and WebSocket
Classes One API class per group of operations, one model class per request and response One client with sub-APIs (client.bim, client.fs, …)
Packages Maven nl.bimbase.bimworks:sdk, NuGet BIMworks.Sdk, npm @bimworks/sdk, Composer bimbase/bimworks, Python bimworks npm @bimworks/jssdk (and the viewers), Maven nl.bimbase.bimworks:client, NuGet BIM.works_SDK
Use for New integrations, servers and scripts, any language The 3D and 2D viewers, which build on the JavaScript one, and existing integrations

Which one to use#

  • A new integration in Java, .NET, TypeScript, PHP or Python: the OpenAPI SDK of that language. What it can do is listed per operation in the API part, where every operation runs on its page.
  • A web page with the 3D or 2D viewer: the classic JavaScript SDK, @bimworks/jssdk. The viewers take its client, and the viewer packages are installed with it (JavaScript and TypeScript).
  • An existing integration on a classic SDK: it keeps working; the classic SDKs are still built, published and documented. Move to the OpenAPI SDK when you touch the code anyway; nothing has to move at once.
  • A language without an SDK: call the API over HTTPS. Each operation page shows the request with curl.

The two families share no package name, namespace or class, so an application can use both side by side while it moves.

The OpenAPI SDKs#

Each OpenAPI SDK is generated by openapi-generator from the same document the API part shows, so its classes and methods follow the operations one to one: the group (tag) of an operation is the API class, the operation id is the method, and the request and response objects are model classes. Its reference — every class, method and model with an example — is generated from what the generator actually wrote, so a name on these pages is the name in the package of the same version.

SDK Package Reference
Java 17+ nl.bimbase.bimworks:sdk on https://maven.bim.works Java SDK
.NET 8+ (the library also targets .NET Standard 2.0) BIMworks.Sdk on nuget.org .NET SDK
TypeScript and JavaScript, Node.js 18+ and browsers @bimworks/sdk on https://npm.bim.works TypeScript SDK
PHP 8.1+ bimbase/bimworks from the BIM.works Composer registry PHP SDK
Python 3.9+ bimworks on https://pypi.bim.works/simple/ Python SDK

One example shape#

Every example of an OpenAPI SDK, on these reference pages and on the operation pages of the API part, is a complete program with the same four steps, in every language:

  1. Connect — a client for your instance (BIM_WORKS_ADDRESS/openapi), logged in with your API token: the login returns an auth token, which every later call sends as its bearer token.
  2. The request — the request object, built from the same JSON the API part shows, so the body of a request reads the same in every language and on the operation's page.
  3. The call — the operation's method on its API class.
  4. The result — printed, or for a file written to disk.

So an example runs as it is once the package is installed: copy it, put in your address, your API token and the UUIDs it names, and run it. On the operation pages of the API part the address and the demo models of your instance are filled in for you; the API token never is. The connect step is the same in every example of a language; a program that makes several calls keeps one client and repeats steps 2 to 4.

The classic SDKs#

The classic SDKs are hand-written clients of the task API: a client factory logs in, and the client's sub-APIs call the server's tasks. They offer some things the OpenAPI does not have yet, and the JavaScript SDK is what the viewers are built on.

SDK Package Reference
JavaScript @bimworks/jssdk on https://npm.bim.works Classic JavaScript SDK
Java 17+ nl.bimbase.bimworks:client on https://maven.bim.works Classic Java SDK
.NET Standard 2.0 BIM.works_SDK on nuget.org Classic .NET SDK

How-to pages that show classic SDK code label it Classic SDK; code labelled OpenAPI SDK uses the generated SDKs.

Pages#

  • Java SDKThe Java SDK generated from the OpenAPI document (Maven nl.bimbase.bimworks:sdk) — the artifact, connecting and logging in, the four steps of every example, the API classes and models, errors, files and uploads.
  • .NET SDKThe .NET SDK generated from the OpenAPI document (NuGet BIMworks.Sdk) — the package, connecting and logging in, the four steps of every example, the API classes and models, responses and errors, files and uploads.
  • TypeScript SDKThe TypeScript and JavaScript SDK generated from the OpenAPI document (npm @bimworks/sdk) — installation, connecting and logging in, the four steps of every example, the API classes and models, errors, files and uploads.
  • PHP SDKThe PHP SDK generated from the OpenAPI document (Composer bimbase/bimworks) — the package, connecting and logging in, the four steps of every example, the API classes and models, errors, files and uploads.
  • Python SDKThe Python SDK generated from the OpenAPI document (bimworks on the BIM.works Python index) — the package, connecting and logging in, the four steps of every example, the API classes and models, errors, files and uploads.