Partager via


Search for Media Items with Certain Keywords

 

Applies To: Windows Server 2012 Essentials

Searches for media items that contain certain keywords.

URI Template

GET services/builtin/MediaManagement.svc/search/mediaType/{mediaTypeData}/groupingMethod/{groupingMethodData}/index/{startingIndexData}/count/{requestedCountData}?keywords={keywords}&grouping={groupingData}&titleOnly={titleOnlyData}

{mediaTypeData}
The media type. Choose from one of the following values.

Media Type Value Meaning
music Audio.
photo Photos.
video Video.

{groupingMethodData}
The grouping method. Choose from one of the following values.

Grouping Method Value Applicable Media Types Meaning
album music Group by album.
albumartist music Group by album artist.
all music, photo, or video Group by media type.
artist music Group by artist.
date photo Group by date.
folder photo or video Group by folder.
genre music Group by musical genre (style).
playlist music Group by playlist.
rating music Group by rating.

{startingIndexData}
The numerical position of the first media item to be retrieved.

{requestedCountData}
The requested number of media items to be retrieved.

{keywords}
A space-separated list of keywords to search for.

{groupingData}
The path to the container. To specify the root container, leave this parameter empty.

{titleOnlyData}
true to search only on the title; otherwise, false. If this parameter is not specified, the default value is false.

Sample Request

GET https://www.contoso.com/services/builtin/MediaManagement.svc/search/mediaType/photo/groupingMethod/all/index/0/count/100?keywords=JPEG&grouping=&titleOnly=true HTTP/1.1  
Accept: application/xml  
Cookie: ASP.NET_SessionId=********************  
Canary: *********************  
Host: domainname  
Content-Length: 0  

Sample Response

HTTP/1.1 200 OK  
<MetadataResult  
    xmlns="http://contracts.microsoft.com/WindowsServerEssentials/2011/09/WebApi"  
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
  <Result>  
    <MetadataBase i:type="MetadataItem">  
      <Date>11/16/2004</Date>  
      <Id>B-358</Id>  
      <Title>Exif_JPEG_422</Title>  
      <TypeName>MetadataItem</TypeName>  
      <Album>[No Keywords]</Album>  
      <AlbumArtist>[Unknown Artist]</AlbumArtist>  
      <Duration i:nil="true"/>  
      <ParentFullPath/>  
      <Rating i:nil="true"/>  
      <Resolution>640x480</Resolution>  
      <Size>106524</Size>  
    </MetadataBase>  
    <MetadataBase i:type="MetadataItem">  
      <Date>11/16/2004</Date>  
      <Id>B-372</Id>  
      <Title>Exif_JPEG_422</Title>  
      <TypeName>MetadataItem</TypeName>  
      <Album>[No Keywords]</Album>  
      <AlbumArtist>[Unknown Artist]</AlbumArtist>  
      <Duration i:nil="true"/>  
      <ParentFullPath/>  
      <Rating i:nil="true"/>  
      <Resolution>640x480</Resolution>  
      <Size>105677</Size>  
    </MetadataBase>  
    <MetadataBase i:type="MetadataItem">  
      <Date>11/19/2004</Date>  
      <Id>B-373</Id>  
      <Title>Exif_JPEG_422</Title>  
      <TypeName>MetadataItem</TypeName>  
      <Album>[No Keywords]</Album>  
      <AlbumArtist>[Unknown Artist]</AlbumArtist>  
      <Duration i:nil="true"/>  
      <ParentFullPath/>  
      <Rating i:nil="true"/>  
      <Resolution>640x480</Resolution>  
      <Size>100079</Size>  
    </MetadataBase>  
    <MetadataBase i:type="MetadataItem">  
      <Date>11/16/2004</Date>  
      <Id>B-374</Id>  
      <Title>Exif_JPEG_422</Title>  
      <TypeName>MetadataItem</TypeName>  
      <Album>[No Keywords]</Album>  
      <AlbumArtist>[Unknown Artist]</AlbumArtist>  
      <Duration i:nil="true"/>  
      <ParentFullPath/>  
      <Rating i:nil="true"/>  
      <Resolution>640x480</Resolution>  
      <Size>107086</Size>  
    </MetadataBase>  
    <MetadataBase i:type="MetadataItem">  
      <Date>11/16/2004</Date>  
      <Id>B-375</Id>  
      <Title>Exif_JPEG_422</Title>  
      <TypeName>MetadataItem</TypeName>  
      <Album>[No Keywords]</Album>  
      <AlbumArtist>[Unknown Artist]</AlbumArtist>  
      <Duration i:nil="true"/>  
      <ParentFullPath/>  
      <Rating i:nil="true"/>  
      <Resolution>640x480</Resolution>  
      <Size>93239</Size>  
    </MetadataBase>  
    <MetadataBase i:type="MetadataItem">  
      <Date>11/16/2004</Date>  
      <Id>B-376</Id>  
      <Title>Exif_JPEG_422</Title>  
      <TypeName>MetadataItem</TypeName>  
      <Album>[No Keywords]</Album>  
      <AlbumArtist>[Unknown Artist]</AlbumArtist>  
      <Duration i:nil="true"/>  
      <ParentFullPath/>  
      <Rating i:nil="true"/>  
      <Resolution>640x480</Resolution>  
      <Size>106418</Size>  
    </MetadataBase>  
  </Result>  
  <TotalMatches>6</TotalMatches>  
</MetadataResult>  

Error Codes

Error Code Error Message
400 One or more parameters are not valid.
401 Access is denied to the requested resource.
404 The path does not exist.

Remarks

If no keywords are specified, no results are returned.

See Also

Web Service Methods