iModels API Sample Application
Overview
This is a simple React based application that demonstrates iModel management workflow that can be achieved using iModels API:
- Loading the iModels for a project
- Loading Changesets and Named Versions for an iModel
- Creating a Named Version for a specific Changeset
The communication with the iModels API is implemented in the iModelHubService
class. Full iModels API documentation can be found in Developer Portal.
This application is built using components from @itwin/itwinui-react library.
Note: This application is not production ready and is intended to only be run locally.
Prerequisites
In order to run this application user has to have a SPA client with imodels:read
and imodels:modify
scopes and a project that has iModels. Instructions on how to create a SPA client can be found in this tutorial under section "Register an Application".
Run the code
1. Configure the application by entering the appropriate values in .env
file:
REACT_APP_AUTH_CLIENT_ID
: Enter the ClientID for the client you registered.REACT_APP_PROJECT_ID
: Enter the project id that the application will display iModels for.
The rest of the configuration has default values that do not have to be changed.
2. Install npm packages
npm install
3. Serve the application
npm start
Client Packages
This application defines IModelsService class to wrap API calls. It supports only a few operations, is very minimal and is intended to demonstrate the basics on how to consume the iModels API.
Open source TypeScript client packages are available for iModels API:
- @itwin/imodels-client-management - NPM registry, documentation
- @itwin/imodels-client-authoring - NPM registry, documentation
Please check the general documentation for explanation on the difference between the packages.