Get All Assets
The GET endpoint retrieves all assets available in the system.
Endpoint
- URL:
/asset/all - Method:
GET
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Response
- Status Code: 200 OK
Sample Response Body
{
"success": true,
"data": [
{
"_id": "664f1e685ef340dfe52581ea",
"name": "/",
"type": "folder",
"parentFolder": null,
"size": 54351317,
"tags": [],
"assignedProducts": [],
"assignedCategories": [],
"createdAt": "2024-05-23T10:46:00.260Z",
"updatedAt": "2024-09-06T14:06:10.817Z",
"id": "664f1e685ef340dfe52581ea"
},
{
"_id": "66acca92536e993c9a3aac2f",
"name": "Arun",
"type": "image/webp",
"parentFolder": "664f1e685ef340dfe52581ea",
"link": "https://cdn.mydckapcommerce.com/663a0afe4587085935a4f9dc/image/chat_1722600080844.webp",
"key": "663a0afe4587085935a4f9dc/image/chat_1722600080844.webp",
"size": 220273,
"title": "chat.png",
"altText": "chat.png",
"tags": [],
"assignedProducts": [],
"assignedCategories": [],
"createdAt": "2024-08-02T12:01:22.419Z",
"updatedAt": "2024-08-03T05:10:08.732Z",
"id": "66acca92536e993c9a3aac2f"
}
// Additional asset items...
],
"pagination": {
"count": 10,
"asset": 1,
"total": 29
}
}
Success Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates the success status of the request, typically true. |
data | array | A list of asset objects. Each object contains detailed asset info. |
pagination | object | Contains pagination details of the retrieved assets. |
Data Array
Each item in the data array represents an asset and can include the following fields:
| Field | Type | Description |
|---|---|---|
_id | string | Unique identifier of the asset. |
name | string | The name or title of the asset. |
type | string | The type of the asset (e.g., "folder", "image/webp"). |
parentFolder | string | Identifier of the parent folder, if available. |
link | string | URL link to access the asset. (only for files) |
key | string | Key associated with the asset, typically a path. |
size | number | Size of the asset in bytes. |
title | string | Title of the asset file. |
altText | string | Alternative text for the asset. |
tags | array | Tags associated with the asset. |
assignedProducts | array | List of products assigned to the asset. |
assignedCategories | array | List of categories assigned to the asset. |
createdAt | string | Timestamp when the asset was created. |
updatedAt | string | Timestamp when the asset was last updated. |
id | string | Duplicate of _id, unique identifier. |
Pagination Object:
| Field | Type | Description |
|---|---|---|
count | int | Number of assets in the response. |
page | int | Current asset page number. |
total | int | Total number of available assets. |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Invalid input data. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Ensure you provide a valid and active access token in the request header to authenticate your request.
- The response includes pagination details for handling large datasets.