Skip to content
Branch: master
Find file History
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Merged PR 44639: Integration test documentation - Document required v… Oct 25, 2019 Pull all existing samples and setup Rush to build them all Sep 9, 2019 Stripped simple-viewer-app to create the basic viewport app Sep 9, 2019
tslint.json Pull all existing samples and setup Rush to build them all Sep 9, 2019


Copyright © 2019 Bentley Systems, Incorporated. All rights reserved.

imodel-query-agent is an example of an agent that illustrates use of the iModel.js API to listen and query changes made to iModels on the iModelHub. A separate optional imodel-changeset-test-utility can be used to generate sample change sets that can then be consumed by this sample.

More specifically, this sample application demonstrates use of iModel.js API to:

* Listen to 'Change Sets' posted to the iModels on the iModelHub.
* Listen to 'Named Versions' created for iModels on the iModelHub.
* Query and download these Change Sets from the iModelHub.
* Parse the Change Sets to construct a 'Change Summary' of useful information contained in them.
* Iterate and query the information contained in the Change Summary.

Watch the console for various messages that show the progress:

* Register event handlers that listen to Change Sets being posted to the iModelHub.
* Register event handlers that listen to Named Versions created on the iModelHub.
* Receive notification of a new Change Set posted to the iModelHub.
* Receive notification of a new Named Version created on the iModelHub.
* Extract Change Summary information from the Change Set.
* Dump the contents of the Change Summary as a JSON file to disk.

See for comprehensive documentation on the iModel.js API and the various constructs used in this sample.

Important note about registrations using iModel.js v0.191.0 and prior

The authorization method of agent clients has been changed in versions >=0.192.0. Therefore all registrations using agent clients created before 0.192.0 have been invalidated. To continue using your app with versions >=0.192.0 please create a new agent registration here. (i.e. You will need a client_id that starts with service-xxxxxx if using iModel.js versions >=0.192.0.) The new registration process is easy, fully automated, and can be completed in minutes.

Development Setup

  1. Follow the Agent Development Setup section under Sample Agent Apps to configure, install dependencies, build, and run the app.

  2. (Optional) Follow the Development Setup process to setup the imodel-changeset-test-utility. The utility can be used to generate and push sample change sets to the iModelHub that can then be consumed by this sample.

Run Query Agent

  1. Start this sample application with npm start.

  2. (Optional) Immediately start the imodel-changeset-test-utility to generate and push change sets by following the procedure documented in its README.

Run automated tests

The sample includes some tests to validate its behavior - these are useful for internal testing:

  • Use npm test to run unit tests
  • Use npm run test:integration to run integration tests


To debug the Query Agent Code click the launch configuration Attach to Main.js in the debug menu for VS code. Then in your terminal run npm run start:debug and wait for breakpoints to be hit.


Contributing to iModel.js

You can’t perform that action at this time.