Changed Elements
Download API definition:
This API is a Technical Preview and is available for testing purposes only. Do not use in production.
POST https://api.bentley.com/changedelements/comparisonjob

Job Creation

Creates a comparison job. The comparison will be queued when first created and will progress to completion. When completed, you can use Get Comparison Job to query the results.

Webhooks

Once a job is finished, an event is triggered via the Webhooks API. All subscribers of the changeElements.jobCompleted.v1 event type will be notified.

Authentication

Requires Authorization header with valid Bearer token for scope itwin-platform.

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

Request headers

Name
Required?
Description
Authorization
Yes

OAuth access token with itwin-platform scope

Accept
Yes

Setting to application/vnd.bentley.itwin-platform.v2+json is recommended.

Request body

ComparisonRequest

Name
Type
Required?
Description
iTwinId
String
Yes

Id of the iTwin where the iModel resides.

iModelId
String
Yes

Id of the iModel to query for status of changesets.

startChangesetId
String
Yes

Id of the changeset to start from. This changeset must occur before end changeset.

endChangesetId
String
Yes

Id of the changeset to end at. This changeset must occur after start changeset.

Example

json
{
    "iTwinId": "e74dc7ec-bc23-41c9-b838-6833f77dc05f",
    "iModelId": "ca3746e1-854c-477c-bde3-e6cd7590d6da",
    "startChangesetId": "1ff311f3-ae9d-48f4-b663-9e28fbf1aeaa",
    "endChangesetId": "5ea41523-fbfd-46e8-be7f-d30c68343a9e"
}

Response 202 Accepted

Created comparison.

json
{
    "comparisonJob": {
        "status": "Queued",
        "jobId": "16063aa71dfbcee75d32a7c5a31ca40e9bb2b094-8968f5c4449d26c0dababf37aed17dcc49d7059f",
        "iTwinId": "1036c64d-7fbe-47fd-b03c-4ed7ad7fc829",
        "iModelId": "0db82dc1-e871-4209-b40a-6753c6a68c19",
        "startChangesetId": "16063aa71dfbcee75d32a7c5a31ca40e9bb2b094",
        "endChangesetId": "8968f5c4449d26c0dababf37aed17dcc49d7059f"
    }
}

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.

json
{
    "error": {
        "code": "HeaderNotFound",
        "message": "Header Authorization was not found in the request. Access denied."
    }
}

Response 403 Forbidden

The user has insufficient permissions for the requested operation.

json
{
    "error": {
        "code": "InsufficientPermissions",
        "message": "The user has insufficient permissions for the requested operation."
    }
}

Response 404 Not Found

This response indicates that the provided iTwin, iModel, or changeset ids could not be found.

json
{
    "error": {
        "code": "ComparisonNotFound",
        "message": "Requested comparison is not available."
    }
}

Response 409 Conflict

Comparison with these start and end changeset ids already exists.

json
{
    "error": {
        "code": "ComparisonExists",
        "message": "Comparison with these start and end changeset ids already exists."
    }
}

Response 422 Unprocessable Entity

Cannot create comparison. Likely due to the request payload having an invalid field(s).

json
{
    "error": {
        "code": "InvalidChangedElementsRequest",
        "message": "Can not create comparison.",
        "details": [{
                "code": "MissingRequiredProperty",
                "message": "Required property 'iModelId' is missing.",
                "target": "iModelId"
            },
            {
                "code": "MissingRequiredProperty",
                "message": "Required property 'iTwinId' is missing.",
                "target": "iTwinId"
            },
            {
                "code": "MissingRequiredProperty",
                "message": "Required property 'startChangesetId' is missing.",
                "target": "startChangesetId"
            },
            {
                "code": "MissingRequiredProperty",
                "message": "Required property 'endChangesetId' is missing.",
                "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.

json
{
    "error": {
        "code": "RateLimitExceeded",
        "message": "The client sent more requests than allowed by this API for the current tier of the client."
    }
}

Response headers

Name
Description
retry-after

Number of seconds to wait until client is allowed to make more requests.

Create Comparison Response

A response containing information regarding the newly created comparison.

Name
Type
Description
comparisonJob

Details for the new comparison.

NewComparison

Information related to the new comparison.

Name
Type
Description
status
String

A string reflecting the status of the comparison. The statuses are: Queued, Started, Completed, or Failed.

jobId
String

Comprised of start changeset Id and end changeset Id in the following format {startChangesetId}-{endChangesetId}.

iTwinId
String

Id of the iTwin where the iModel resides.

iModelId
String

Id of the iModel to query for status of changesets.

startChangesetId
String

Id of the changeset to start from. This changeset must occur before end changeset.

endChangesetId
String

Id of the changeset to end at. This changeset must occur after start changeset.

ComparisonRequest

A payload for creating a new comparison. The comparison payload must have an iTwinId, iModelId, startChangesetId, endChangesetId.

Name
Type
Description
iTwinId
String

Id of the iTwin where the iModel resides.

iModelId
String

Id of the iModel to query for status of changesets.

startChangesetId
String

Id of the changeset to start from. This changeset must occur before end changeset.

endChangesetId
String

Id of the changeset to end at. This changeset must occur after start changeset.

Error

Contains error information.

Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String, null

The target of the error.

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.

Name
Type
Description
error

Error information.

Was this page helpful?