searchAssetsByMetadata searchassetsbymetadata
Searches the metadata index repository for the given search terms. Returns asset data like the searchAssets method.
While searchAssetsByMetadata
lets you search against User-Defined Metadata Fields, those fields are not returned if they are specified in the responseMetadataArray
. To illustrate this point, the following code example:
<ns:responseMetadataArray>
<ns:items>custom_attributes.x</ns:items>
</ns:responseMetadataArray>
returns a null value:
<items>
<name>custom_attributes.x</name>
<value>null</value>
</items>
To work around this issue, you can use the fieldHandles
of the assets that are returned from the search to run getAssets
(see also getAssets). This method gets the User-Defined Fields values for the assets in question. Use the following syntax example to search against User-Defined Metadata Fields:
<ns:metadataConditionArray>
<ns:items>
<ns:fieldHandle>custom_attributes.[UDF Field Name]</ns:fieldHandle>
<ns:op>[Conditional]</ns:op>
<ns:value>[Value]</ns:value>
</ns:items>
</ns:metadataConditionArray>
Authorized User Types section-9f85dd55ab574104b5fdc0f95aa0a0e2
IpsUser
IpsAdmin
IpsCompanyAdmin
ImagePortalAdmin
ImagePortalUser
ImagePortalContrib
ImagePortalContribUser
Parameters section-5f1edb9c5b914160ab361f4364b8aa8d
Input (searchAssetsByMetadataParam)
Output (searchAssetsByMetadataReturn)
xsd:int
types:AssetArray
metadataConditionArray Details section-1af4a4a22f82451eabdf6dfe13d9f27d
Item Structure
metadataConditionArray
structure is as follows:
<ns1:items>
<ns:fieldHandle>field_handle</ns:fieldHandle>
<ns:op>operator</ns:op>
<ns:value>comparison_value</ns:value>
</ms1:items>
Values
field_handle
is the metadata search key. It can contain dot notation. Possible values include:
-
asset_id
(without prefix) -
name
-
folder_path
-
type
-
file_name
-
description
-
comment
-
user_data
-
sku
-
modified_at
-
modified_by
-
created_at
(same asmodified_at
(Date in the form: Fri Jul 25 2014 22:13:45 GMT-0500 (CDT)) -
created_by
Allowed Operators
The operator defines how to compare the value and include:
Equals
NotEquals
Contains
NotContains
StartsWith
EndsWith
The comparison_value
is the term to search for.
Examples section-53a12b9c023e4e629eddf5719c955ad4
This code sample performs a search with the following metadata criteria:
-
name
field contains1000801
. -
dc.rights
field equalsPer Jessen Schmidt
.
Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.scene7.com/IpsApi/xsd"
xmlns:ns="http://www.scene7.com/IpsApi/xsd/2010-01-31">
<soapenv:Header>
<xsd:authHeader>
<xsd:user>user@adobe.com</xsd:user>
<xsd:password>topSecret</xsd:password>
</xsd:authHeader>
</soapenv:Header>
<soapenv:Body>
<ns:searchAssetsByMetadataParam>
<ns:companyHandle>c|656</ns:companyHandle>
<ns:metadataConditionArray>
<ns:items>
<ns:fieldHandle>name</ns:fieldHandle>
<ns:op>Contains</ns:op>
<ns:value>1000801</ns:value>
</ns:items>
<ns:items>
<ns:fieldHandle>dc.rights</ns:fieldHandle>
<ns:op>Equals</ns:op>
<ns:value>Per Jessen Schmidt</ns:value>
</ns:items>
</ns:metadataConditionArray>
<ns:responseMetadataArray>
<ns:items>dc.subject</ns:items>
<ns:items>xmp.CreatorTool</ns:items>
</ns:responseMetadataArray>
</ns:searchAssetsByMetadataParam>
</soapenv:Body>
</soapenv:Envelope>
Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<searchAssetsByMetadataReturn xmlns="http://www.scene7.com/IpsApi/xsd/2010-01-31">
<totalRows>1</totalRows>
<assetSummaryArray>
<items>
<assetHandle>a|885289</assetHandle>
<type>Image</type>
<name>test9-1000801</name>
<folder>Extroscope/Test subfolders/</folder>
<filename>test9-1000801.jpg</filename>
<created>2009-11-19T07:21:24.252-08:00</created>
<createUser>pschmidt@adobe.com</createUser>
<lastModified>2009-11-19T07:21:25.487-08:00</lastModified>
<lastModifyUser>pschmidt@adobe.com</lastModifyUser>
<metadataArray>
<items>
<name>dc.subject</name>
<value>[San Fransico, USA</value>
</items>
<items>
<name>xmp.CreatorTool</name>
<value>Ver.1.0</value>
</items>
</metadataArray>
</items>
</assetSummaryArray>
</searchAssetsByMetadataReturn>
</soapenv:Body>
</soapenv:Envelope>