Getting iModel

To work with iModelHub, you have to know your iModel's id. Most of the iModelHub requests will ask for an iModel id and you can specify it from by providing HubIModel.wsgId property. If you do not have an iModel for your CONNECT Project yet, you first have to create it.

If iModel is already created, its HubIModel instance can be retrieved by querying iModels:

export async function getIModelId(requestContext: AuthorizedClientRequestContext, projectId: string): Promise<string | undefined> {
  const client = new IModelHubClient();
  const imodels = await client.iModels.get(requestContext, projectId);
  return imodels ? imodels[0].wsgId : undefined;
}

Last Updated: 03 June, 2019