Asset

View as Markdown

Asset

Retrieves a single asset, specify its UID.

NameTypeDescription
uid str

Readonly property to check value of asset’s uid

fetch

This call fetches the latest version of a specific asset of a particular stack

import contentstack;


stack = contentstack.Stack(api_key, delivery_token, environment);

asset = stack.asset(uid='asset_uid')

response = asset.fetch()

include_fallback

Retrieve the published content of the fallback locale if an entry is not localized in specified locale

import contentstack;


stack = contentstack.Stack(api_key, delivery_token, environment);

asset = stack.asset(uid='asset_uid')

asset = asset.include_fallback()

include_dimension

Include the dimensions (height and width) of the image in the response. Supported image types: JPG, GIF, PNG, WebP, BMP, TIFF, SVG, and PSD

import contentstack;


stack = contentstack.Stack(api_key, delivery_token, environment);

asset = stack.asset(uid='asset_uid')

asset = asset.include_dimension()

include_metadata

Includes asset metadata along with response body.

import contentstack


stack = contentstack.Stack('api_key', 'delivery_token', 'environment')

response = stack.asset('asset_uid').include_metadata().find()

print(response)

relative_urls

Include the relative URLs of the assets in the response

import contentstack;


stack = contentstack.Stack(api_key, delivery_token, environment);

asset = stack.asset(uid='asset_uid')

asset = asset.relative_urls()

environment

Provide the name of the environment if you wish to retrieve the assets published in a particular environment

import contentstack;


stack = contentstack.Stack(api_key, delivery_token, environment);

asset = stack.asset(uid='asset_uid')

asset = asset.environment('environment_name')

params

params is used to pass additional parameters to the asset query

import contentstack;


stack = contentstack.Stack(api_key, delivery_token, environment);

asset = stack.asset(uid='asset_uid')

asset = asset.param('key', 'value')

remove_environment

Removes environment from the request params

import contentstack;


stack = contentstack.Stack(api_key, delivery_token, environment);

asset = stack.asset(uid='asset_uid')

asset = asset.

('production')