Assets API
Overview
The Assets API allows you to add assets to the system such as images and PDF files. This page covers the common endpoints and methods associated with the Assets API.
Authentication
Use the following header parameters for all requests:
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Worskpace ID Header |
Assets Details
Get a List of All Assets
GET /api/v3/asset/listProperties | |
---|---|
id integer | Asset ID |
storagePath string | File path of asset |
cdnUrl string | URL of asset |
created integer | Unix epoch timestamp of asset creation, in milliseconds |
modifiedDate string | Date asset modified |
disposable boolean | Indicates whether asset is temporary and can be purged (true), default: true |
- JSON
- TypeScript
Response 200
{
"success": true,
"data": [
{
"id": 1,
"storagePath": "assets/201427/tfteBYO_1704204958735.jpg",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/tfteBYO_1704204958735.jpg",
"created": 1704204961147,
"modifiedDate": "2024-01-02T14:16:08.726+0000",
"disposable": false
},
{
"id": 2,
"storagePath": "assets/201427/b7c0tTw_1704204968864.jpg",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/b7c0tTw_1704204968864.jpg",
"created": 1704204971010,
"modifiedDate": "2024-01-02T14:16:11.375+0000",
"disposable": false
},
{
"id": 3,
"storagePath": "assets/201427/2mBGamD_1704205759807.jpg",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/2mBGamD_1704205759807.jpg",
"created": 1704205761106,
"modifiedDate": "2024-01-02T08:59:21.508+0000",
"disposable": false
}
]
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
id: number;
storagePath: string;
cdnUrl: string;
created: number;
modifiedDate: string;
disposable: boolean
}[]
}
}
}
}
function getAllAssets(): Promise<Responses> {
const options = {
method: 'GET',
url: 'https://app.iqm.com/api/v3/asset/list',
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Get Asset Details
GET /api/v3/asset/{assetId}Get properties of a single asset by ID
Path Parameters | |
---|---|
assetId integer | Asset ID |
- JSON
- TypeScript
Response 200
{
"success": true,
"data": {
"id": 1,
"storagePath": "new/path/to/asset.jpg",
"cdnUrl": "https://cdn.example.com/new_asset.jpg",
"created": 1704204961147,
"modifiedDate": "2024-01-18T06:03:23.823+0000",
"disposable": true
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
id: number;
storagePath: string;
cdnUrl: string;
created: number;
modifiedDate: string;
disposable: boolean
}
}
}
}
}
function getAssetDetails(): Promise<Responses> {
const options = {
method: 'GET',
url: 'https://app.iqm.com/api/v3/asset/{assetId}',
params: {
path: {
assetId: `number`
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Assets Management
Add Multiple Assets
POST /api/v3/assetAdd multiple assets to the system. Request accepts an array of multipart file objects and their corresponding metadata.
Request Schema | |
---|---|
filesMetaData integer | JSON string representing the metadata associated with the files |
files string | Files to add |
- JSON
- TypeScript
Response 200
{
"success": true,
"data": {
"9d41a99a-9761-44cf-a3db-307a57b65795.jpg": {
"assetID": 697,
"assetCDNURL": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/IHp2jMI_1704987233847.jpg"
}
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
statusCode: number;
responseObject: {
files: {
assetID: number;
assetCDNURL: string
}
}
}
}
};
401: {
content: {
Authorization?: string;
"X-IAA-OW-ID"?: string;
};
path: {
assetId: number
}
}
}
function addAssets(): Promise<Responses> {
const options = {
method: 'POST',
url: 'https://app.iqm.com/api/v3/asset',
params: {
query: {
filesMetadata: `string`,
files: `string`,
},
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Update Asset Details
PATCH /api/v3/asset/{assetId}Update the details of an existing asset by ID
Path Parameters | |
---|---|
assetId integer | Asset ID |
Request Schema | |
---|---|
storagePath string | File path of asset |
cdnUrl string | Asset CDN URL |
disposable boolean | Indicates whether asset is temporary and can be purged (true), default: true |
- JSON
- TypeScript
Request Sample
{
"storagePath": "string",
"cdnUrl": "string",
"disposable": true
}
Response 200
{
"success": true,
"data": {
"statusCode": 200,
"responseObject": {
"message": "Asset updated successfully"
}
}
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
statusCode: number;
responseObject: {
message: string
}
}
}
}
};
401: {
content: {
"application/json": {
success?: boolean;
errorObjects?: {
error?: string;
reason?: string;
field?: string;
}[];
data?: Record<string, never>;
}
}
}
}
function updateAssetDetails(): Promise<Responses> {
const options = {
method: 'PATCH',
url: 'https://app.iqm.com/api/v3/asset/{assetId}',
params: {
path: {
assetId: `number`,
}
},
requestBody: {
content: {
"application/json": {
storagePath?: `string`,
cdnUrl?: `string`,
disposable?: `boolean`,
}
}
},
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Delete Asset
DELETE /api/v3/asset/{assetId}Delete single asset by ID
Path Parameters | |
---|---|
assetId integer | Asset ID |
- JSON
- TypeScript
Response 200
{
"success": true,
"data": "Asset deleted successfully."
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: string
}
}
};
401: {
content: {
Authorization?: string;
"X-IAA-OW-ID"?: string;
};
path: {
assetId: number;
}
}
}
function deleteAsset(): Promise<Responses> {
const options = {
method: 'DELETE',
url: 'https://app.iqm.com/api/v3/asset/{assetId}',
params: {
path: {
assetId: `number`
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}