# Assets
#Available from v.3.2.0 Assets are files that can be stored in the system and referenced on products, variants, categories and global list values. Assets uploaded to the system are assigned a URL based on the assets file name. Each image asset can be auto-scaled, cropped and formatted by adding parameters to the URL of the asset. Thus, you should only upload an image once in the highest quality you will need it and the system will take care of any scaling automatically. Assets are organized in folders, which can be nested within each other.
PUT /assets Update filename and folder for a batch of assets
#Available from v.3.2.0
{
"321102": {
"FolderId": "46",
"Filename": "New asset filename"
},
"321223": {
"FolderId": "4",
"Filename": "Updated filename"
}
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
model | body | object |
Models with information to update assets with |
Response status OK (200)
POST /assets Create new asset
#Available from v.3.2.0
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
folderId | query | string |
Id of folder to place asset in |
uploadedFile | formData | file |
Upload File |
Response status OK (200)
DELETE /assets Delete multiple assets
#Available from v.3.2.0
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
ids | body | array : string |
Ids of assets to delete |
Response status OK (200)
GET /assets/{id} Get an asset
#Available from v.3.2.0
{
"Id": "321102",
"Name": "struct-logo",
"Url": "https://structpim.com/media/wuqj0ouk/struct-logo.png",
"Extension": "png",
"FileType": "Image",
"Created": "2020-10-12T12:43:27+02:00",
"LastModified": "2020-11-01T11:43:27+01:00",
"ParentId": "10"
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of asset |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
Id | string |
Unique id of asset |
Name | string |
Name of asset |
Url | string |
Url of asset |
Extension | string |
The file extension of the asset |
FileType | string |
The type of file this asset is (file or image) |
Type | string |
The type of asset (as specified in SupportedAssetTypes) |
Created | string |
Timestamp of asset creation |
LastModified | string |
Timestamp of last asset modification |
Properties | object |
Properties |
ParentId | string |
ParentId of asset. May be null. |
PUT /assets/{id} Update an assets' filename and folder
#Available from v.3.2.0
{
"FolderId": "46",
"Filename": "New asset filename"
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of asset |
model | body | object : UpdateAssetModel |
Property name | Data type | Description |
---|---|---|
FolderId | string |
New folder id of asset |
Filename | string |
New name of asset |
Response status OK (200)
DELETE /assets/{id} Delete an asset
#Available from v.3.2.0
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of asset |
Response status OK (200)
PUT /assets/{id}/data Update physical file for asset
#Available from v.3.2.0
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of asset |
uploadedFile | formData | file |
Upload File |
Response status OK (200)
GET /assets/{id}/references Get references to asset
#Available from v.3.2.0
{
"GlobalListValueReferences": [
"c4bb22c0-4ec2-441e-97d5-27c3a94047ae"
],
"VariantReferences": [
3211,
30,
203
],
"VariantGroupReferences": [
10,
20
],
"ProductReferences": [
1000,
201,
2031,
3055
],
"CategoryReferences": [
12,
32
]
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of asset to get references for |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
GlobalListValueReferences | array |
Global list values referencing the asset |
VariantReferences | array |
Variants referencing the asset |
VariantGroupReferences | array |
Variant groups referencing the asset |
ProductReferences | array |
Products referencing the asset |
CategoryReferences | array |
Categories referencing the asset |
POST /assets/batch Get a batch of assets
#Available from v.3.2.0
[
{
"Id": "321102",
"Name": "struct logo",
"Url": "https://structpim.com/media/wuqj0ouk/struct-logo.png",
"Extension": "png",
"FileType": "Image",
"Created": "2020-10-12T12:43:27+02:00",
"LastModified": "2020-11-01T11:43:27+01:00",
"ParentId": "-1"
},
{
"Id": "321223",
"Name": "Pricelist",
"Url": "https://structpim.com/media/bbmn5ztr/pricelist.pdf",
"Extension": "pdf",
"FileType": "File",
"Created": "2020-08-04T09:27:12+02:00",
"LastModified": "2020-08-11T09:27:12+02:00"
}
]
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
ids | body | array : string |
ids of assets to get |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
Id | string |
Unique id of asset |
Name | string |
Name of asset |
Url | string |
Url of asset |
Extension | string |
The file extension of the asset |
FileType | string |
The type of file this asset is (file or image) |
Type | string |
The type of asset (as specified in SupportedAssetTypes) |
Created | string |
Timestamp of asset creation |
LastModified | string |
Timestamp of last asset modification |
Properties | object |
Properties |
ParentId | string |
ParentId of asset. May be null. |
POST /assets/batch/data Get a zip file containing the physical files of assets
#Available from v.3.7.0
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
ids | body | array : string |
Ids of assets |
maxWidth | query | integer |
Max width to scale requested image assets into |
maxHeight | query | integer |
Max height to scale requested image assets into |
format | query | string |
Format to return image assets as. Valid options are jpg, jpeg, bmp, gif, png, png8, tif, tiff, webp |
bgcolor | query | string |
Background color to use when expanding canvas |
Response status OK (200)
PUT /assets/folders Update folders
#Available from v.3.2.0
{
"46": {
"ParentId": "2",
"Name": "New folder name"
},
"4": {
"Name": "Root folder"
}
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
model | body | object |
Model with asset information to update |
Response status OK (200)
POST /assets/folders Create new folders
#Available from v.3.2.0 Returns dictionary with filename of asset and the assigned id of the asset
[
{
"ParentId": "46",
"Name": "Brand logos"
},
{
"Name": "Root folder"
}
]
{
"Apple images": "3211",
"Pricelists": "3288"
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
models | body | array : CreateFolderModel |
Models with information on folders to create |
Property name | Data type | Description |
---|---|---|
ParentId | string |
Id of parent to put this folder in (null if this folder shall be placed at root level) |
Name | string |
Name of folder |
Response status OK (200)
DELETE /assets/folders Delete multiple folders
#Available from v.3.2.0
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
ids | body | array : string |
Ids of folders to delete |
Response status OK (200)
GET /assets/folders/{id} Get folder
#Available from v.3.2.0
{
"Id": "3211",
"ParentId": "45",
"Name": "Apple images"
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of folder |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
Id | string |
Unique id of folder |
ParentId | string |
Id of parent folder (null if folder is at root level) |
Name | string |
Name of folder |
PUT /assets/folders/{id} Update a folder
#Available from v.3.2.0
{
"ParentId": "46",
"Name": "New folder name"
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of folder |
model | body | object : UpdateFolderModel |
Model with folder information to update |
Property name | Data type | Description |
---|---|---|
ParentId | string |
New parent of folder |
Name | string |
New name of folder |
Response status OK (200)
DELETE /assets/folders/{id} Delete a folder
#Available from v.3.2.0
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of folder |
Response status OK (200)
GET /assets/folders/{id}/assets Get assets in folder
#Available from v.3.2.0 Use "root" as id to get assets in the root directory of the media archive
[
{
"Id": "321102",
"Name": "struct logo",
"Url": "https://structpim.com/media/wuqj0ouk/struct-logo.png",
"Extension": "png",
"FileType": "Image",
"Created": "2020-10-12T12:43:27+02:00",
"LastModified": "2020-11-01T11:43:27+01:00",
"ParentId": "-1"
},
{
"Id": "321223",
"Name": "Pricelist",
"Url": "https://structpim.com/media/bbmn5ztr/pricelist.pdf",
"Extension": "pdf",
"FileType": "File",
"Created": "2020-08-04T09:27:12+02:00",
"LastModified": "2020-08-11T09:27:12+02:00"
}
]
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of folder to get assets for |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
Id | string |
Unique id of asset |
Name | string |
Name of asset |
Url | string |
Url of asset |
Extension | string |
The file extension of the asset |
FileType | string |
The type of file this asset is (file or image) |
Type | string |
The type of asset (as specified in SupportedAssetTypes) |
Created | string |
Timestamp of asset creation |
LastModified | string |
Timestamp of last asset modification |
Properties | object |
Properties |
ParentId | string |
ParentId of asset. May be null. |
GET /assets/folders/{id}/assets/{filename} Get an asset in a folder by its name
#Available from v.3.2.0
{
"Id": "321102",
"Name": "struct-logo",
"Url": "https://structpim.com/media/wuqj0ouk/struct-logo.png",
"Extension": "png",
"FileType": "Image",
"Created": "2020-10-12T12:43:27+02:00",
"LastModified": "2020-11-01T11:43:27+01:00",
"ParentId": "10"
}
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of folder to search within |
filename | path | string |
Filename to search for |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
Id | string |
Unique id of asset |
Name | string |
Name of asset |
Url | string |
Url of asset |
Extension | string |
The file extension of the asset |
FileType | string |
The type of file this asset is (file or image) |
Type | string |
The type of asset (as specified in SupportedAssetTypes) |
Created | string |
Timestamp of asset creation |
LastModified | string |
Timestamp of last asset modification |
Properties | object |
Properties |
ParentId | string |
ParentId of asset. May be null. |
GET /assets/folders/{id}/subfolders Get child folders
#Available from v.3.2.0 Use "root" as id to get folders in the root directory of the media archive
[
{
"Id": "3211",
"ParentId": "45",
"Name": "Apple images"
},
{
"Id": "3288",
"ParentId": "46",
"Name": "Pricelists"
}
]
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
id | path | string |
Id of folder to get children for |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
Id | string |
Unique id of folder |
ParentId | string |
Id of parent folder (null if folder is at root level) |
Name | string |
Name of folder |
POST /assets/folders/batch Get a batch of folders
#Available from v.3.2.0
[
{
"Id": "3211",
"ParentId": "45",
"Name": "Apple images"
},
{
"Id": "3288",
"ParentId": "46",
"Name": "Pricelists"
}
]
Request parameters
Property name | Parameter type | Data type | Description |
---|---|---|---|
ids | body | array : string |
Ids of folders to return |
Response status OK (200)
Property name | Data type | Description |
---|---|---|
Id | string |
Unique id of folder |
ParentId | string |
Id of parent folder (null if folder is at root level) |
Name | string |
Name of folder |
GET /assets/ids Get ids of all assets in the system
[
"100",
"101",
"102",
"103",
"104"
]