Get Asset Changes

Returns a list of changes that have been made to assets from a certain point in time onward.

Key information:

  • The response is limited to a few hundred changes. The end response parameter indicates the ending point of the
    response. Use this ending point in a subsequent request as a new starting point from which to
    find changes.

  • One use for this endpoint is to synchronize a third-party CMS with our CMS.

  • The response includes changes that occur:

    • At or after the point defined by the start parameter.
    • At or before the point defined by the end parameter.

    This means that a subsequent request will include the last change reported within the previous request.

  • The system tracks asset deletions for a small rolling window. Capture all asset deletions by calling this endpoint at least once
    every 6 hours.

  • Asset information provided in the response reflects the state of the asset when the endpoint was requested.

    Example:

    If an asset was created and updated within the requested time range, then both of those changes would be included in the response. However, the assets response parameter will only describe the latest version of the asset. This information will reflect any changes that may have been applied to the asset after the end of the requested time range.

Request

Request syntax:

GET /api2/asset/changes

Request parameters:

Pass the following parameters through the msg parameter:

Request ParameterTypeDescription
start RequiredIntegerDefines the starting point for which changes will be reported. Syntax: Unix time in milliseconds

Response

Response body parameters are described below.

Response ParameterTypeDescription
startIntegerIndicates the value defined in the start request body parameter.
endIntegerIndicates the ending point for the changes included in the response. Use this value as the starting point for subsequent calls.
changesListDescribes each change within the above time period by: The timestamp at which the change took place. Time is reported in Unix time (milliseconds). The type of change. Valid values are: createupdatedelete * Asset ID.
assetsDictionaryContains information that describes the assets in the change list. Each item in this dictionary maps an asset ID to information about the asset as of the time at which this endpoint was requested. The information provided in this parameter is not specific to a change reported within the changes list.

Sample Request/Response

The following sample request retrieves changes to assets starting from 1391714449648 (Unix time in milliseconds). The Call() function, which is imported from uplynk_api2_auth module, prepares the message body and digital signature.

from uplynk_api2_auth import Call

print(Call('/api2/asset/changes', start=1391714449648))

{
    "changes": [
        [
            1391796562910,
            "update",
            "1ca770087e7a46a7aec4f8aebc198aff"
        ],
        [
            1391796578879,
            "delete",
            "1ca770087e7a46a7aec4f8aebc198aff"
        ]
    ],
    "assets": {
        "1ca770087e7a46a7aec4f8aebc198aff": {
            "orig_filename": null,
            "rays": 7,
            "require_drm": 1,
            "require_studio_drm": 0,
            "created": 1391104683934,
            "deleted": 1391796578879,
            "lastmod": 1391796562910,
            "autoexpire": 0,
            "slices": 10,
            "job_type": "live",
            "duration": 40.651999999999994,
            "id": "1ca770087e7a46a7aec4f8aebc198aff",
            "desc": "Live Capture",
            ...
        }
    },
    "start": 1391714449648,
    "end": 1391800857638,
    "error": 0
}