Create an empty iModel
This quick start is intended to help you understand what an iModel is and how to leverage iTwin Platform iModels API for managing it.
By the end of this walk-through, you will be able to create an empty iModel using iModels API which later on can be used as a destination iModel for your synchronization workflow.
1. Register an Application
To build an application on the iTwin Platform, you will need to register a client.
Click the Register Application button on the right-hand side to automatically register a client for this quick start. You can find registered application in My apps page.
Optional: Manual Application registration process
To manually register a client:
- Go to https://developer.bentley.com
- Click the Sign In button and sign-in using your Bentley account credentials
- If you have not already registered, click Register now and complete the registration process.
- Click on your user icon and navigate to the My Apps page
- Click the Register New button
- Give your application a Name
- Select the Data Management API
- Select application type SPA (Single Page Web Application)
- Enter Redirect URL
- For this tutorial use
- For this tutorial use
- Leave post logout redirect URIs empty.
- Click the Save button
2. Get a token
To make request to API user token is needed. There are several ways to get it.
Follow this article to implement Authorization code workflow in your application.
- Go to Create Connection - Synchronization
- Click “Try it” button.
- On Authorization section select “AuthorizationCode”.
- After popup closes Authorization header with your user token value should be visible.
- Save user token value for this tutorial.
3. Create an empty iModel
An iModel is a specialized information container for exchanging data associated with the lifecycle of infrastructure assets. iModels were created to facilitate the sharing and distribution of information regardless of the source and format of the information.
iTwin Platform iModels API is based on iModelHub cloud service which enables alignment, accountability and accessibility of infrastructure digital twins. It is the control center for iModels and is responsible for coordinating concurrent access to iModels as well as changes made to them.
An empty iModel is created by sending a HTTP POST message to https://api.bentley.com/imodels/ endpoint with the payload describing the iModel to be created.
There are two required properties for the create iModel payload.
name - iModel name is required which uniquely identifies the iModel within the Project.
projectId - provides Project identifier that created iModel will belong to. Project identifier is required property.
description - free form text field so you could give more information about the iModel.
extent - iModels usually are placed at some location on the Earth. This property allows to specify the maximum rectangular area on the Earth which encloses the iModel. The maximum extent is used to help keep your iModel clean. When new elements are imported, those outside the extent will be flagged for further processing. This extent will also help to zoom to the area of interest in web viewers.
You can execute the request in Create iModel documentation page, “Try it” section.
Since an empty iModel does not contain any graphical elements or any data it cannot be opened yet for viewing. In order to bring data to the created iModel you may setup synchronization connection which will transform engineering data from native design formats to iModel. Once the synchronization has been setup and executed, viewing session can be started.