Obtains which elements have changed in the iModel between the given start and end changesets.
This information will only be available after change tracking has been enabled and the processing operation completes.
Understanding Change
The comparison returns a ChangedElements object. This interface contains different arrays of the same size. Each element is specified by a single index in all arrays. Some of the relevant arrays to understand what changes occurred to an element are listed below:
opcodes: Contains the operation codes that tells us if the element was inserted, updated, or deleted in the change. See DbOpcode for more information. The appropriate values are listed below:
type: Contains the type of change that occurred to the element. This number is a bit-flag and can be used to know whether the element had property changes, geometric changes, placement changes, indirect changes, and hidden property changes. See TypeOfChange for more information. Below is a table with the values and their meaning:
Authentication
Requires Authorization header with valid Bearer token for scope changedelements:read.
For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.
Request parameters
[Deprecated] Id of the iTwin the iModel resides in.
Id of the iTwin where the iModel resides.
Changeset Id for the beginning of the comparison range.
Changeset Id for the ending of the comparison range.
Id of iModel to get a comparison for.
Request headers
OAuth access token with itwin-platform scope
Setting to application/vnd.bentley.itwin-platform.v1+json is recommended.
Response 200 OK
OK
{ "changedElements": { "elements": [3298534887273], "classIds": ["0x670"], "opcodes": [23], "modelIds": [2199023255554], "type": [1], "properties": [ ["UserLabel"] ], "oldChecksums": [ [1448094486] ], "newChecksums": [ [362149254] ], "parentIds": ["0"], "parentClassIds": ["0"] } }
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.
{ "$ref": "#/components/examples/401.HeaderNotFound.example" }
Response 403 Forbidden
The user has insufficient permissions for the requested operation.
{ "error": { "code": "InsufficientPermissions", "message": "The user has insufficient permissions for the requested operation." } }
Response 404 Not Found
This response indicates that provided comparison results are not ready or unexistent.
{ "error": { "code": "ComparisonNotFound", "message": "Requested comparison for the given changesets is not available." } }
Response 422 Unprocessable Entity
A URL parameter was malformed or there are missing required parameters.
{ "error": { "code": "InvalidChangedElementsRequest", "message": "Could not get comparison.", "details": [{ "code": "MissingRequiredParameter", "message": "Query parameter must be provided.", "target": "iModelId" }, { "code": "MissingRequiredParameter", "message": "Query parameter must be provided.", "target": "projectId" }, { "code": "MissingRequiredParameter", "message": "Query parameter must be provided.", "target": "startChangesetId" }, { "code": "MissingRequiredParameter", "message": "Query parameter must be provided.", "target": "endChangesetId" }, { "code": "InvalidValue", "message": "'abc' is not a valid 'iModelId'.", "target": "iModelId" }, { "code": "InvalidValue", "message": "'abc' is not a valid 'projectId'.", "target": "projectId" }, { "code": "InvalidValue", "message": "'abc' start changeset Id results in invalid comparison.", "target": "startChangesetId" }, { "code": "InvalidValue", "message": "'abc' end changeset Id results in invalid comparison.", "target": "endChangesetId" }] } }
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.
Error
Contains error information.
One of a server-defined set of error codes.
The target of the error.
A human-readable representation of the error.
{ "type": "object", "required": [ "code", "message" ], "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "target": { "type": "string", "nullable": true, "description": "The target of the error." }, "message": { "type": "string", "description": "A human-readable representation of the error." } }, "description": "Contains error information.", "additionalProperties": true }
Operation Code
Operation code of change that occurred to an element. Delete: 9, Insert: 18, Update: 23.
Class Id
EC Class Id in hex string representation of an element.
Model Id
Model Id in hex string representation of a model.
Element Id
Element Id in hex string representation of an element.
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", "required": [ "error" ], "properties": { "error": { "$ref": "#/components/schemas/Error", "description": "Error information." } }, "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.", "additionalProperties": false }
Checksum List
Array of checksums for the properties of an element
Type Of Change
Type of change that occurred to an element in bitflags. To be used with iModelJs 'TypeOfChange' class
Element Properties
Array of properties that have changed in the element between the two changesets
Changed Elements (get)
Array of changed elements' array of changed properties
Array of changed elements' array of new checksums for each property
Array of changed elements' array of old checksums for each property
{ "type": "object", "title": "Changed Elements (get)", "properties": { "changedElements": { "type": "object", "title": "Changed Element Data", "properties": { "type": { "type": "array", "items": { "$ref": "#/components/schemas/type-of-change" }, "description": "Array of changed elements' type of change" }, "opcodes": { "type": "array", "items": { "$ref": "#/components/schemas/opcode" }, "description": "Array of changed elements' operation codes" }, "classIds": { "type": "array", "items": { "$ref": "#/components/schemas/class-id" }, "description": "Array of changed element's class Id" }, "elements": { "type": "array", "items": { "$ref": "#/components/schemas/element-id" }, "description": "Array of changed elements' Ids" }, "modelIds": { "type": "array", "items": { "$ref": "#/components/schemas/model-id" }, "description": "Array of changed elements' model Ids" }, "parentIds": { "type": "array", "items": { "$ref": "#/components/schemas/element-id" }, "description": "Array of changed elements' parent Ids" }, "properties": { "type": "array", "items": { "$ref": "#/components/schemas/element-properties" }, "description": "Array of changed elements' array of changed properties" }, "newChecksums": { "type": "array", "items": { "$ref": "#/components/schemas/checksum-list" }, "description": "Array of changed elements' array of new checksums for each property" }, "oldChecksums": { "type": "array", "items": { "$ref": "#/components/schemas/checksum-list" }, "description": "Array of changed elements' array of old checksums for each property" }, "parentClassIds": { "type": "array", "items": { "$ref": "#/components/schemas/class-id" }, "description": "Array of changed elements' parent class Ids" } }, "description": "Changed elements data arrays", "additionalProperties": false } }, "additionalProperties": false }
Was this page helpful?