Retrieves the results of an ECSQL query using the query ID. This operation is used to get results for queries that returned status 201 from the POST operation.
Query States
The response will include the current state of the query:
- Pending: Query is queued for execution
- Running: Query is currently being executed
- Completed: Query finished successfully, results are available
- Failed: Query execution failed, error details are provided
Query Parameters
The following optional query parameters control the response format and pagination:
includeMetadata
- Whether to include column metadata in the responselimit
- Maximum number of rows to return per pageskip
- Number of rows to skip (for pagination)
Response Behavior
- Pending queries: Returns query ID and current state only
- Running queries: Returns query ID, current state, metadata (if requested), and any partial results available so far
- Completed queries: Returns query ID, current state, metadata (if requested) and query results
- Failed queries: Returns error information and failure details
Data Retention
Query results are available for 24 hours after completion. After this period, the query ID will no longer be valid.
Request parameters
iTwin ID
iModel ID
changeset ID
Query ID
Maximum number of rows to return per page.
Number of rows to skip.
Whether to include column metadata in the response.
Request headers
OAuth access token with itwin-platform
scope
Setting to application/vnd.bentley.itwin-platform.v1+json
is recommended.
Response 200 OK
A response
{ "id": "620b43a3-a30e-48d8-92a8-ab1eb0fd591d", "state": "Completed", "rows": [ [ "0x1", "0xcf", { "Id": "0x1", "RelECClassId": "0x40" }, "2022-12-15T12:40:13.047Z", { "Id": "0x1f", "RelECClassId": "0x47" }, { "Id": "0x1", "RelECClassId": "0x49" }, "BayTown_Sample" ] ], "links": { "self": "http://api.bentley.com/imodel-query/itwins/1f947d72-9983-4e46-89c2-e9ed9a3d4fec/imodels/4276bd1d-959b-4078-83c3-501571409a97/changesets/6cee950fcdfa3f01df925c04ed10fae1bfb233e7/queries/620b43a3-a30e-48d8-92a8-ab1eb0fd591d" }, "meta": [{ "className": "", "name": "ECInstanceId", "typeName": "long", "accessString": "ECInstanceId", "extendedType": "Id" }, { "className": "", "name": "ECClassId", "typeName": "long", "accessString": "ECClassId", "extendedType": "ClassId" }, { "className": "BisCore:Element", "name": "Model", "typeName": "navigation", "accessString": "Model" }, { "className": "BisCore:Element", "name": "LastMod", "typeName": "dateTime", "accessString": "LastMod" }, { "className": "BisCore:Element", "name": "CodeSpec", "typeName": "navigation", "accessString": "CodeSpec" }, { "className": "BisCore:Element", "name": "CodeScope", "typeName": "navigation", "accessString": "CodeScope" }, { "className": "BisCore:Element", "name": "CodeValue", "typeName": "string", "accessString": "CodeValue" }, { "className": "BisCore:Element", "name": "UserLabel", "typeName": "string", "accessString": "UserLabel" }, { "className": "BisCore:Element", "name": "Parent", "typeName": "navigation", "accessString": "Parent" }, { "className": "BisCore:Element", "name": "FederationGuid", "typeName": "binary", "accessString": "FederationGuid", "extendedType": "BeGuid" }, { "className": "BisCore:Element", "name": "JsonProperties", "typeName": "string", "accessString": "JsonProperties", "extendedType": "Json" } ] }
Response 401 Unauthorized
This response indicates that request lacks valid authentication credentials. Access token might not been provided, issued by the wrong issuer, does not have required scopes or request headers were malformed.
{ "error": { "code": "HeaderNotFound", "message": "Header Authorization was not found in the request. Access denied." } }
Response 429 Too many requests
This response indicates that the client sent more requests than allowed by this API for the current tier of the client.
{ "error": { "code": "RateLimitExceeded", "message": "The client sent more requests than allowed by this API for the current tier of the client." } }
Response headers
Number of seconds to wait until client is allowed to make more requests.
QueryResponse
Error
Contains error information.
One of a server-defined set of error codes.
A human-readable representation of the error.
The target of the error.
{ "type": "object", "description": "Contains error information.", "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "message": { "type": "string", "description": "A human-readable representation of the error." }, "target": { "type": "string", "description": "The target of the error.", "nullable": true } }, "required": [ "code", "message" ], "additionalProperties": true }
Error Response
Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.
{ "type": "object", "title": "Error Response", "description": "Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.", "properties": { "error": { "description": "Error information.", "$ref": "#/components/schemas/Error" } }, "required": [ "error" ], "additionalProperties": false }
Was this page helpful?