This is a minimal example of a command-line iTwin.js application that downloads an iModel from iModelHub and prints the result of an ECSQL query.
- Node: an installation of the latest security patch of Node 14.
Edit IMODELHUB_REQUEST_PROPS
in Main.ts to replace iTwinId and iModelId with the appropriate
values for your iModel.
You will also need to provide a clientId, scope and redirectUri for your application. To register an application, go to https://developer.bentley.com/register/.
- Add "Digital Twin Management" as API Associations to get the "imodels:read" scope
- Select "Desktop/Mobile" as the Application Type
- Enter "http://localhost:3000/signin-callback" for Redirect URI
- No logout URI is required
Once your application is created, go to its details page and copy/paste the scope, clientId and redirectUri fields
into AUTH_CLIENT_CONFIG_PROPS
in Main.ts.
Open your favorite shell to the root of the cloned repository and:
npm install
npm run build
npm start