Asset Instance Resource

GET

Lists the attributes for the given asset.

The ‘Accept-Language’ HTTP header may optionally be provided to get a particular translation of an attribute’s label and value. If this is not provided or it is not a valid Asset Bank language code, the default language will be used.

Note: The approved field in the asset returned by this resource is read only (i.e. submitting a PUT request to it won’t change the approval status of the asset). Its potential values are true or false (i.e. it doesn’t support the partial approval status that can result when an asset is in multiple workflows - those assets will be shown as unapproved).

Example:

curl -X GET -H "Accept: application/json" http://127.0.0.1:8080/asset-bank/rest/assets/1 > asset.json

Response (contents of “asset.json” file):

{
  "attributes": [
    {
      "id": "8",
      "name": "dateAdded",
      "value": "17/03/2011 16:05:02"
    },
    {
      "id": "6",
      "name": "originalFilename",
      "value": "1.jpg"
    }
    {
      "id": "9",
      "name": "title",
      "value": "An oak tree"
    },
    <...ETC...>
  ],
  "parents":["http://127.0.0.1:8080/asset-bank/rest/assets/10"],
  "accessLevelIds": "1",
  "submitted": false,
  "url": "http://127.0.0.1:8080/asset-bank/rest/assets/1",
  "contentUrl": "http://127.0.0.1:8080/asset-bank/rest/assets/1/content",
  "contentUrlUrl": "http://127.0.0.1:8080/asset-bank/rest/assets/1/content/url",
  "displayUrl": "http://127.0.0.1:8080/asset-bank/rest/assets/1/display",
  "thumbnailUrl": "http://127.0.0.1:8080/asset-bank/servlet/display?file=9ab.jpg",
  "previewUrl": "http://127.0.0.1:8080/asset-bank/servlet/display?file=9cd.jpg",
  "conversionUrl": "http://127.0.0.1:8080/asset-bank/rest/assets/1/conversion",
  "unwatermarkedLargeImageUrl": "http://127.0.0.1:8080/asset-bank/servlet/display?file=8a8.jpg",
  "approved": true
}

PUT

Updates the attributes for the given asset. API clients should first GET the attributes on the asset, update the attributes as necessary, and then PUT the representation back to the original URL. Some attributes are read-only and will not be writable. If you attempt to update a read-only attribute through the API, the attribute will not update, and the response will show the asset representation without the attribute having been updated. Standard text, date, time and datetime attributes are writable, as are categories and access levels. Attributes such as the original filename, filesize, last modified date, and the ‘added by’ user will not be writable. The submitted field indicates whether the asset has been submitted to live (i.e. so that it is viewable by other Asset Bank users). If it is false you can submit the asset by changing the value to true. Note, if an asset is already submitted to live you cannot un-submit it. Trying to do so via the API will result in an error. The parents field enables the parent asset(s) to be set for the current asset. If a list of valid asset instance resource urls is provided they will be set as the asset’s parents, if an empty list is provided the asset will be removed from any parents it currently has and if the list is not provided at all then the assets parents will remain unchanged. If invalid urls are passed then an error will be thrown by the resource.

Updating the thumbnailUrl, previewUrl, and unwatermarkedLargeImageUrl will have no effect, as these files are generated by Asset Bank. Parameters userId (optional): Asset Bank id of the user to update the asset as. The user must have edit permission on the asset. If omitted the asset will be updated as the application user. When acting as a user who is not the application user, the user must have the appropriate permission to edit the asset. If not the PUT will be refused. If the user has only edit with approval permission on the asset then it will go through the standard approval process and the asset edits will need to be approved before being visible to other users. Note, if an asset is submitted to live (via the submitted field) then it will be the user’s upload not edit permissions which will determine whether the asset goes for approval.

Example: [Using “out.json” in the previous example, modify one of the writable values, e.g. attribute 9 “value”: “An oak tree” -> “value”: “An elm tree”] and change submitted to true to submit the asset to live.

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" --data "@asset.json" http://127.0.0.1:8080/asset-bank/rest/assets/1?userId=10

Response:

{
  "attributes": [
    {
      "id": "8",
      "name": "dateAdded",
      "value": "17/03/2011 16:05:02"
    },
    {
      "id": "6",
      "name": "originalFilename",
      "value": "1.jpg"
    }
    {
      "id": "9",
      "name": "title",
      "value": "An oak tree"
    },
    <...ETC...>
  ],
  "parents":["http://127.0.0.1:8080/asset-bank/rest/assets/10"],
  "accessLevelIds": "1",
  "submitted": true,
  "url": "http://127.0.0.1:8080/asset-bank/rest/assets/1",
  "contentUrl": "http://127.0.0.1:8080/asset-bank/rest/assets/1/content",
  "contentUrlUrl": "http://127.0.0.1:8080/asset-bank/rest/assets/1/content/url",
  "displayUrl": "http://127.0.0.1:8080/asset-bank/rest/assets/1/display",
  "thumbnailUrl": "http://127.0.0.1:8080/asset-bank/servlet/display?file=9ab.jpg",
  "previewUrl": "http://127.0.0.1:8080/asset-bank/servlet/display?file=9cd.jpg",
  "unwatermarkedLargeImageUrl": "http://127.0.0.1:8080/asset-bank/servlet/display?file=8a8.jpg"
}

DELETE

Delete the given asset. Gets a 204 No Content response back Parameters userId (optional): Asset Bank id of the user to delete the asset as. The user must have delete permission on the asset. If omitted, the asset will be deleted by the currently authenticated user (if using OAuth2), or the application user.

Example:

curl -X DELETE http://127.0.0.1:8080/asset-bank/rest/assets/1

Response:

204 No Content