Reporting

Mappings

Download API definition:

POST https://sampleHostName/insights/reporting/datasources/imodels/{imodelId}/mappings/{mappingId}/groups

Creates a Group for an iModel data source Mapping. A Group is a collection of design elements from an iModel represented by an ECSQL query and defines one table in the output data of a report.

Group Query

The query parameter of a Group supports ECSql and ECClassIds.

If a valid ECSql query is given and the selected class is bis.Element, or if it is a descendant of the class bis.Element, the only required column is ECInstanceId.

  • SELECT * FROM bis.Element is a valid query
  • Assuming that class Building.Beam is a descendant of the class bis.Element, the query SELECT * FROM Building.Beam is a valid query
  • SELECT ECInstanceId FROM bis.Element is a valid query
  • Assuming that class Building.Beam is a descendant of the class bis.Element, the query SELECT ECInstanceId FROM Building.Beam is valid
  • SELECT ECClassId FROM bis.Element is not a valid query because ECInstanceId column is missing
  • Assuming that class Building.Beam is a descendant of the class bis.Element, the query SELECT ECClassId FROM Building.Beam is not valid because ECInstanceId column is missing
  • Assuming that Building.BeamAspect is an aspect, the query SELECT A.ECInstanceId FROM bis.Element E JOIN Building.BeamAspect A ON A.Element.id = E.ECInstanceId is not valid because the selected ECInstanceId is of the aspect, not the element
  • Assuming that Building.BeamAspect is an aspect, the query SELECT A.Element.id FROM Building.BeamAspect is not valid because the selected column's name is not ECInstanceId
  • Assuming that Building.BeamAspect is an aspect, the query SELECT A.Element.id ECInstanceId FROM Building.BeamAspect is valid

In all other cases when providing an ECSql query it is required to select ECInstanceId, ECClassId, and all other columns that you are planning to use for mapping. If only ECInstanceId and ECClassId are selected and other columns are used for mapping, those columns will be filled with null values. If either ECInstanceId or ECClassId column is not selected, the query will not produce any output.

If the query parameter does not contain a valid ECSql query, then it must be equal to bis.Element, bis.ElementAspect, or any of their descendants.

The ECClassId format {schemaName}:{schemaItemName} where schemaName does not contain a 3-part version number is supported.

The ECClassId format {schemaName}.{schemaItemName} is supported.

The ECClassId format {schemaAlias}:{schemaItemName} where schemaAlias is the alias of a schemaName is supported.

The ECClassId format {schemaFullName}:{schemaItemName} where schemaFullName contains a 3-part version number is not supported.

When the given ECClassId is equal to bis.Element or is one of its descendants, then all elements with the ECClassId will be selected.

When the given ECClassId is equal to bis.ElementAspect or is one of its descendants, then all elements that have such aspect will be selected.

When the given ECClassId is none of the above, the query will not produce any output.

  • If a class Building.Beam does not have any subclasses and the query parameter is set to Building.Beam, then all elements with ECClassIds of Building.Beam will be selected
  • If there is a class Building.StructuralMember which has 2 subclasses Building.Beam and Building.Column, and the query parameter is set to Building.StructuralMember, then all elements with ECClassIds of Building.StructuralMember, Building.Beam, and Building.Column will be selected
  • If a class Building.BeamAspect inherits from a class bis.ElementAspect (is unique or multi aspect) and the query parameter is set to Building.BeamAspect, then all elements that have a Building.BeamAspect attached to them will be selected. This query will not select the aspects themselves, but the elements that they are attached to. The selected elements may have any ECClassId
  • If there is class Building.StructuralMemberAspect which has 2 subclasses Building.BeamAspect and Building.ColumnAspect, the Building.StructuralMemberAspect class inherits from a class bis.ElementAspect (is unique or multi aspect) and the query parameter is set to Building.StructuralMemberAspect, then all elements that have Building.StructuralMemberAspect, Building.BeamAspect, or Building.ColumnAspect attached to them will be selected. This query will not select the aspects themselves, but the elements that they are attached to. The selected elements may have any ECClassId

If different queries are needed for a single output table, then create multiple Groups with those different queries but with the same name for each Group. That will cause results of all these queries to be concatenated into a single output table. The output table will have column list equal to a union of all GroupProperties of Groups with the same name.

Authentication

Requires Authorization header with valid Bearer token for scope insights:modify.

For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.

Authorization

User must have imodels_write permission(s) assigned at the Project level. iModel specific permissions may also be applied at the iModel level if iModel level permissions are enabled.

Alternatively the user should be an Organization Administrator for the Organization that owns a given Project or iModel.

An Organization Administrator must have at least one of the following roles assigned in User Management: Account Administrator, Co-Administrator, or CONNECT Services Administrator. For more information about User Management please visit our Bentley Communities Licensing, Cloud, and Web Services wiki page.

Rate limits

All iTwin Platform API operations have a rate limit. For more documentation on that visit Rate limits and quotas page.

Extraction row limiting

Mappings created or modified by using the "Try it out" function can only extract a maximum of 100 rows for each group. Mapping modification is considered any POST/DELETE/PATCH/PUT request to any endpoint with the tag "Mappings" or if the URL contains {mappingId}.