👀 A quick look at how assets work.
Asset endpoint is an API endpoint within the Yepic API platform that allows users to access stock or user-uploaded content. These endpoints provide a way for developers to retrieve and use a variety of multimedia assets such as images, videos, audio, and other types of content.
⚙️ How It Works
There are six Type
of Asset that we support:
Assets |
---|
Image |
Video |
Audio |
Text |
Spreadsheet |
Template |
☎️ API Calls - Examples
1. GET - Retrieve a list of assets
This endpoint helps you to get a list of available assets. You can set how many pages and how many assets will be displayed in one response.
curl --request GET \
--url 'https://api.yepic.ai/v1/assets?PageSize=25&Page=1' \
--header 'X-Api-Key: YOUR_API_KEY' \
--header 'accept: application/json'
{
"assets": []
}
2. GET - Retrieve an asset
This endpoint helps you to get a single asset. You can set to retrieve an asset to be shown to the User by asset ID.
curl --request GET \
--url 'https://api.yepic.ai/v1/assets/{6d86f99b-28c9-49ca-95cf-12a646a4d589}' \
--header 'X-Api-Key: YOUR_API_KEY' \
--header 'accept: application/json'
{
"id": "6d86f99b-28c9-49ca-95cf-12a646a4d589",
"name": "Test Asset (Postman)",
"url": "https://yepic-api-asset-storage-staging.s3.eu-west-2.amazonaws.com/6d86f99b-28c9-49ca-95cf-12a646a4d589.png?X-Amz-Expires=43200&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXTRTYVQOYN73OYUI%2F20230831%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230831T032714Z&X-Amz-SignedHeaders=host&X-Amz-Signature=6d5373dff2df4d2f930f787e539bec87c1ebbb77bd80e27d489768bf1b7ab1c8",
"originalFileUrl": "https://yepic-api-postman-test-collection-assets.s3.eu-west-2.amazonaws.com/asset-test.png",
"extension": ".png"
}
3. UPDATE - Create an asset
This endpoint allows you to Update an existing asset from the user by asset ID.
curl -X 'PATCH' \
'https://api.yepic.ai/v1/assets/a585266d-1af5-4a0f-a6df-0af2c024b0de' \
-H 'accept: application/json' \
-H 'X-Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "Test asset (Change)"
}'
{
"id": ""
}
4. DELETE - Delete an asset
With this endpoint, you can delete existing assets by inputting their id.
curl --request DELETE \
--url https://api.yepic.ai/v1/assets \
--header 'X-Api-Key: YOUR_API_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"id":"ASSET_ID"}'
{}
5. POST - Import an asset by URL
Unlike adding assets by uploading files, this endpoint will import the asset using the file URL.
curl --request POST \
--url https://api.yepic.ai/v1/assets/import/url \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"name": "",
"fileUrl": "",
"type": ""
}
'
{
"id": "fe817623-41eb-4c6e-ad0c-0f3476c4a415",
"name": "Try asset",
"url": "https://yepic-api-asset-storage-staging.s3.eu-west-2.amazonaws.com/fe817623-41eb-4c6e-ad0c-0f3476c4a415.png?X-Amz-Expires=43200&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXTRTYVQOYN73OYUI%2F20230901%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230901T022432Z&X-Amz-SignedHeaders=host&X-Amz-Signature=d9164d524bb4da7a5e15135a2109d217231d863897fcfa730d28a58698c597d9",
"originalFileUrl": null
}
6. POST - Import an asset by HTML Form File upload
This endpoint will import the asset using the file HTML form to upload File.
curl --request POST \
--url https://api.yepic.ai/v1/assets/import \
--header 'X-Api-Key: YOUR_API_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '
{
"name": "ASSET_NAME",
"fileUrl": "ASSET_URL",
"type": "Image"
}
'
{
"id": "fe817623-41eb-4c6e-ad0c-0f3476c4a415",
"name": "Try asset",
"url": "https://yepic-api-asset-storage-staging.s3.eu-west-2.amazonaws.com/fe817623-41eb-4c6e-ad0c-0f3476c4a415.png?X-Amz-Expires=43200&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXTRTYVQOYN73OYUI%2F20230901%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230901T022432Z&X-Amz-SignedHeaders=host&X-Amz-Signature=d9164d524bb4da7a5e15135a2109d217231d863897fcfa730d28a58698c597d9",
"originalFileUrl": null
}
7. POST - Import an asset by JSON
This endpoint will import the asset using the JSON-based format to upload the File.
curl --request POST \
--url https://api.yepic.ai/v1/assets/import/json \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"name": "",
"file": "data:[<mediatype>][;base64],<data>",
"type": ""
}
'
'
{
"id": "fe817623-41eb-4c6e-ad0c-0f3476c4a415",
"name": "Try asset",
"url": "https://yepic-api-asset-storage-staging.s3.eu-west-2.amazonaws.com/fe817623-41eb-4c6e-ad0c-0f3476c4a415.png?X-Amz-Expires=43200&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXTRTYVQOYN73OYUI%2F20230901%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230901T022432Z&X-Amz-SignedHeaders=host&X-Amz-Signature=d9164d524bb4da7a5e15135a2109d217231d863897fcfa730d28a58698c597d9",
"originalFileUrl": null
}