REST List API for MediaAssetFile entity
The REST List API for MediaAssetFile entity provides searching, reporting, navigation, deletion and finally result listing of MediaAssetFile like other general objects in system.
Since PIM 8.0 the MediaAssetFile entity is redefined for the media asset object, but currently it is only supported by PIM Core with Media Manager.
The data access for the MediaAssetFile entity is not per PIM database, but per the connector API, so that the corresponding persistence logic like fragments, mediators and reports are adjusted in a special way, therefore it is meaning to introduce the REST List API for that with this additional chapter.
-
Retrieve media asset file with "byIdentifiers" report for external id
Retrieve media asset file with "byItems" report for internal id
Retrieve media asset files which belong(be assigned) to a category and are used in PIM core
Retrieve all media asset files which belong to a category or its child categories
Update media asset file language special attribute(Sub Entity)
Adjustments for MediaAssetFile entity
The REST List API access for general object is already described in REST List API, which is also available for the MediaAssetFile entity with some adjustments.
Internal id
Each PIM entity needs an unique internal id which should be a long value and usually comes from the database. For the MediaAssetFile entity it is converted from the media asset identifier (PKOM_PNR) of Media Manager in the way which replaces the first character "D" with the "9".
For example the media asset with identifier D110001123456 has then an internal id 9110001123456.
Special reports
byCategory
Search media asset files which belong (be assigned) to a category
Identifier |
Name |
Description |
Mandatory |
Data type |
Collection |
Entity |
Enumeration |
categoryId |
Category ID |
Category id defined in Media Manager |
true |
STRING |
false |
||
usageFilter |
Usage filter |
Filter all/used/unused media asset files |
false |
INTEGER |
false |
bySearch
Identifier |
Name |
Description |
Mandatory |
Data type |
Collection |
Entity |
Enumeration |
query available since 8.0.03 Hotfixes 1 |
Search query |
The query condition for the search. For details of the syntax to be used, refer to the documentation. If this parameter is not specified, then the parameter "mediaQuery" should be set. |
false |
STRING |
false |
||
mediaQuery |
Special media search query |
Special search query for media asset file. If this parameter is not specified, then the parameter "query" should be set. |
false |
STRING |
true |
||
usageFilter |
Usage filter |
Filter all/used/unused media asset files |
false |
INTEGER |
false |
Search with query
This search is available since the 8.0.03 Hotfixes 1
For detailed information about the search with the parameter "query" please visit the page Search query for MediaAssetFile entity.
Search with mediaQuery
For detailed information about the search with the parameter "mediaQuery" please visit the page Media search query for MediaAssetFile entity.
Examples
Retrieve media asset file with "byIdentifiers" report for external id
curl -u rest:heiler -H
"Accept: application/json"
-H -X GET http:
//localhost:1512/rest/V1.0/list/MediaAssetFile/byIdentifiers?identifiers=D11000100112129&fields=MediaAssetFile.Identifier,MediaAssetFileAttribute.Filename,MediaAssetFileAttributeLang.Memo(en),MediaAssetFileAttributeLang.Memo(german)
A list model result that contains the desired media asset files and attributes is returned:
{
"cacheId"
:
"20150813_172919_0"
,
"entityIdentifier"
:
"MediaAssetFile"
,
"totalSize"
:
1
,
"startIndex"
:
0
,
"pageSize"
:
100
,
"rowCount"
:
1
,
"columnCount"
:
0
,
"columns"
: [],
"rows"
: [
{
"object"
: {
"id"
:
"911000100112129"
,
"label"
:
"Media asset file 911000100112129"
},
"values"
: [
"D11000100112129"
,
"Lighthouse.jpg"
,
"Lighthouse_memo_english"
,
"Lighthouse_memo_german"
]
}
]
}
Retrieve media asset file with "byItems" report for internal id
curl -u rest:heiler -H
"Accept: application/json"
-H -X GET http:
//localhost:1512/rest/V1.0/list/MediaAssetFile/byItems?items=911000100112129,911000100112211&fields=MediaAssetFile.Identifier,MediaAssetFileAttribute.Filename,MediaAssetFileAttributeLang.Memo(en),MediaAssetFileAttributeLang.Memo(german)
A list model result that contains the desired media asset files and attributes is returned:
{
"cacheId"
:
"20150812_164055_0"
,
"entityIdentifier"
:
"MediaAssetFile"
,
"totalSize"
:
2
,
"startIndex"
:
0
,
"pageSize"
:
100
,
"rowCount"
:
2
,
"columnCount"
:
0
,
"columns"
: [],
"rows"
: [
{
"object"
: {
"id"
:
"911000100112129"
,
"label"
:
"Media asset file 911000100112129"
},
"values"
: [
"D11000100112129"
,
"Lighthouse.jpg"
,
"Lighthouse_memo_english"
,
"Lighthouse_memo_german"
]
},
{
"object"
: {
"id"
:
"911000100112211"
,
"label"
:
"Media asset file 911000100112211"
},
"values"
: [
"D11000100112211"
,
"Koala.jpg"
,
"Koala_memo_english"
,
"Koala_memo_german"
]
}
]
}
Retrieve media asset files which belong(be assigned) to a category and are used in PIM core
curl -u rest:heiler -H
"Accept: application/json"
-X GET http:
//localhost:1512/rest/V1.0/list/MediaAssetFile/byCategory?usageFilter=used&CategoryId=009900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&fields=MediaAssetFile.Identifier,MediaAssetFileAttribute.Filename
The following JSON object is returned:
{
"cacheId"
:
"20150812_170313_0"
,
"entityIdentifier"
:
"MediaAssetFile"
,
"totalSize"
:
3
,
"startIndex"
:
0
,
"pageSize"
:
100
,
"rowCount"
:
3
,
"columnCount"
:
0
,
"columns"
: [],
"rows"
: [
{
"object"
: {
"id"
:
"911000100112048"
,
"label"
:
"Media asset file 911000100112048"
},
"values"
: [
"D11000100112048"
,
"text.txt"
]
},
...
]
}
Retrieve all media asset files which belong to a category or its child categories
curl -u rest:heiler -H
"Accept: application/json"
-X GET http:
//localhost:1512/rest/V1.0/list/MediaAssetFile/byCategory?CategoryId=0099%&fields=MediaAssetFile.Identifier,MediaAssetFileAttribute.Filename
The following JSON object is returned:
{
"cacheId"
:
"20160204_181155_0"
,
"entityIdentifier"
:
"MediaAssetFile"
,
"totalSize"
:
191
,
"startIndex"
:
0
,
"pageSize"
:
100
,
"rowCount"
:
100
,
"columnCount"
:
0
,
"columns"
: [],
"rows"
: [
{
"object"
: {
"id"
:
"911000100111676"
,
"label"
:
"Media-Asset-Datei 911000100111676"
,
"entityId"
:
2500
},
"values"
: [
"D11000100111676"
,
"testtest.jpg"
]
}
...
]
}
Update media asset file(Root Entity)
curl -u rest:heiler -H
"Accept: application/json"
-X POST http:
//localhost:1512/rest/V1.0/list/MediaAssetFile
The following JSON object is provided as content:
{
"columns"
: [
{
"identifier"
:
"MediaAssetFileAttribute.AgencyId"
},
{
"identifier"
:
"MediaAssetFileAttribute.Level"
}
,
{
"identifier"
:
"MediaAssetFileAttribute.State"
}
,
{
"identifier"
:
"MediaAssetFileAttribute.Status"
}
,
{
"identifier"
:
"MediaAssetFileAttribute.Finished"
}
,
{
"identifier"
:
"MediaAssetFileAttribute.InProgress"
}
,
{
"identifier"
:
"MediaAssetFileAttribute.Class"
}
,
{
"identifier"
:
"MediaAssetFileAttribute.Categories"
}
],
"rows"
: [
{
"object"
: {
"id"
:
"'D11000100112038'"
},
"values"
: [
"111"
,
0
,
1
,
"s"
,
false
,
true
,
0
, [
"009900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
,
"009900030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
]
]
}
]
}
The following JSON object is returned:
{
"counters"
: {
"errors"
:
0
,
"warnings"
:
0
,
"createdObjects"
:
0
,
"updatedObjects"
:
1
,
"objectsWithErrors"
:
0
,
"objectsWithWarnings"
:
0
},
"entries"
: [],
"objects"
: [
{
"row"
:
0
,
"object"
: {
"id"
:
"911000100112038"
,
"label"
:
"Media asset file 911000100112038"
},
"status"
: [
"UPDATED"
]
}
]
}
Update media asset file language special attribute(Sub Entity)
curl -u rest:heiler -H
"Accept: application/json"
-X POST http:
//localhost:1512/rest/V1.0/list/MediaAssetFile/MediaAssetFileAttributeLang
The following JSON object is provided as content:
{
"columns"
: [
{
"identifier"
:
"MediaAssetFileAttributeLang.Name"
}
],
"rows"
: [
{
"object"
: {
"id"
:
"911000100112038"
},
"qualification"
: {
"language"
:
"English"
},
"values"
: [
"updatedName en"
]
},
{
"object"
: {
"id"
:
"'D11000100112013'"
},
"qualification"
: {
"language"
:
"de"
},
"values"
: [
"updated Name (deu)"
]
}
]
}
The following JSON object is returned:
{
"counters"
: {
"errors"
:
0
,
"warnings"
:
0
,
"createdObjects"
:
0
,
"updatedObjects"
:
2
,
"objectsWithErrors"
:
0
,
"objectsWithWarnings"
:
0
},
"entries"
: [],
"objects"
: [
{
"row"
:
0
,
"object"
: {
"id"
:
"911000100112038"
,
"label"
:
"Media asset file 911000100112038"
},
"status"
: [
"UPDATED"
]
},
{
"row"
:
1
,
"object"
: {
"id"
:
"911000100112013"
,
"label"
:
"Media asset file 911000100112013"
},
"status"
: [
"UPDATED"
]
}
]
}
Delete media asset file with identifier D11000100112532
curl -u rest:heiler -H
"Accept: application/json"
-X DELETE http:
//localhost:1512/rest/V1.0/list/MediaAssetFile/byIdentifiers?identifiers=D11000100112532
or
curl -u rest:heiler -H
"Accept: application/json"
-X DELETE http:
//localhost:1512/rest/V1.0/list/MediaAssetFile/byItems?Items=911000100112532
Create media asset file
Please visit the page Upload single Media Asset File.