Fetching assets
Prepr stores all your digital assets in the Media Library (in Prepr: the Media tab), making it easy to access, view, and manage your assets. You can add, edit, download, or delete files whenever needed; categorize, search, and filter assets on multiple attributes to find the right one quickly.
The Asset object
{
"id": "df7c1544-bad0-4c9d-928f-0c9f684c9ceb",
"created_on": "2023-06-13T14:35:54+00:00",
"changed_on": "2023-06-13T14:35:54+00:00",
"label": "Photo",
"name": "Sed et augue non mi dapibus tincidunt sollicitudin vel leo",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vel ornare massa. Ut vehicula commodo consequat.",
"author": "Marc van Dam",
"status": null,
"reference_id": "dam-249387",
"width": 1020,
"height": 1020,
"original_name": "sed-et-augue.jpg",
"mime_type": "image/jpeg",
"cdn_files": {
"total": 1,
"items": [
{
"id": "bfaac48b-fb0d-4d12-84da-af8d65244c4b",
"created_on": "2023-06-12T08:44:43+00:00",
"label": "CdnFile",
"file": "371apne44zy3.jpg",
"url": "https://example.stream.prepr.io/{format}/371apne44zy3-5az.jpg"
}
]
},
// Additional fields in the Asset model for the default locale
// Boolean field to mark an asset copyrighted
"copyrighted" : true,
"author_name": {
"body" : "John Captura", //An HTML text field for Author name
},
"price": 12.50, // Number field for price
// Additional fields in the Asset model for other locales
// Pass the localized param to get the fields for other locales
"localized" : {
"de-DE" : {
"copyrighted" : true
}
}
}
FIELD | DESCRIPTION |
---|---|
id | Unique identifier for each item. |
created_on | UTC time at which the asset was created/upload. |
changed_on | UTC time at which the asset was last updated. |
label | Identifier for the object. |
name | Name of the asset. |
body | Description of the asset. |
reference_id | Custom asset API ID. |
author | Optional name of the author. |
width | Width of the image of video. |
height | Height of the image of video. |
original_name | Name of the uploaded file. |
mime_type | Mime type of the original file. |
cdn_files | Array, the url field can be used for media playback. |
Fetching all assets
GET: /assets
The pagination of the asset endpoint is identical to the content items endpoints.
Query by ID
Since IDs are unique in Prepr, you can find the asset you want using the id argument. Here is an example that demonstrates how to query an asset with the ID "535c1e-...":
GET: /assets/535c1e-4d52-4794-9136-71e28f2ce4c1
Query by Reference Id
The reference Id is useful for storing external asset Ids. For example, during the migration of assets from another system. Check out the Migration doc for more details.
Here is an example that demonstrates how to query an asset with a Reference Id value.
GET: /assets?reference_id[0][eq]=123456
The API does not check that reference Ids are unique. So, keep this in mind when setting these values.
Was this article helpful?
We’d love to learn from your feedback