Version: 2011.01.25

Krames StayWell External Web Service Documentation

SearchContent Method

This Method will return a small amount of meta-data for each content object that matches the supplied criteria. For a content object to be included, it must match all of the specified criteria. For multi-valued criteria, the content object must match at least one of the supplied values. For instance if two age groups are supplied in the criteria, a content object matches if it is mapped to either one or both of the age groups even if it is also mapped to additional age groups.

Please note that if the search criteria identifies a large result set you should expect a longer response time. Adding or refining the search paramters will shorten the response time.

Parameters: XmlRequest
	<SearchCriteria ReturnAdditionalTitles="[true, false]" IncludeBlocked="[true, false]" SortBy="[Rating, ViewCount, PublishedDate, Title]" SortDirection="[Ascending, Descending]" >
		<Paging PageSize="[int]" PageNumber="[int]" />
		<FullText LogicalOperator="[And,Or]">[string(s)]</FullText>
		<ByTitle IncludeAdditionalTitles="[true, false]">[Title]</ByTitle>
		<ByLetter IncludeAdditionalTitles="[true, false]">[Single Character]</ByLetter>
		<PostingDate>[Date (yyyy-mm-dd)]</PostingDate>
		<EndPostingDate>[Date (yyyy-mm-dd)]</EndPostingDate>
		<Language Code="[en,es]"/>
		<Gender>[All, Male, Female]</Gender>
		<AgeGroups>
			<AgeGroup>[Infant (0 - 11 mo), Childhood (11 mo - 12 yrs), Teen (12 - 18 yrs), Adult (18+), Senior]</AgeGroup>
		</AgeGroups>
		<ContentTypes>
			<ContentType ContentTypeId="[int]"/>
			<ContentType ContentTypeId="[int]"/>
		</ContentTypes>
		<Subtopics>
			<Subtopic RootSubtopicId="[int]"/>
			<Subtopic RootSubtopicId="[int]"/>
			<Subtopic SubtopicId="[int]"/>
			<Subtopic SubtopicId="[int]"/>
		</Subtopics>
		<MeSHList>
			<MeSH Code="[MeSH Code]"/>
			<MeSH Code="[MeSH Code]"/>
		</MeSHList>
		<ICD9List>
			<ICD9 Code="[ICD9 Code]"/>
			<ICD9 Code="[ICD9 Code]"/>
		</ICD9List>
		<CPTList>
			<CPT Code="[CPT Code]"/>
			<CPT Code="[CPT Code]"/>
		</CPTList>
		<Servicelines>
			<Serviceline ServicelineKeyword="[string]" PageKeyword="[string]" Audience="[string]" />
		</Servicelines>
	</SearchCriteria>

At least one of the SearchCriteria child elements is required; a request with just <SearchCriteria /> will result in an error. The order of the elements is not important.

The optional ReturnAdditionalTitles attribute will add a content object's AdditionalTitles to the returned XML if its' value is set to "true". If this attribute is not included, the value is assumed to be "false".

The optional IncludeBlocked attribute will cause the results to include content that is licensed to, but have been blocked by, the client. If this attribute is not included, the default value is "false". It may be useful to include blocked content in search results for client-based administrative or monitoring tools, but generally not for end-user applications.

The optional SortBy and SortDirection attributes are used to return a specific sorting of the content when doing a FullText search. Options for SortBy are Rating, ViewCount, PublishedDate and Title. By default all but Title are sorted in descending order. To return a different sort direction use SortDirection with the value of either Ascending or Descending. If SortDirection is provided without a SortBy then this attribute is ignored.

  • The FullText element specifies the word list to match in the content. Body (for documents) or Transcript (for Streaming Media) are the fields that are searched. The required attribute LogicalOperator specifies how the word list is treated in the search; a value of "And" means that all words in the word list must match, a value of "Or" means that one or more of the words in the word list must match. Quoted phrases may also be included:
    			<SearchCriteria>
    				<FullText LogicalOperator="And">"heart disease" liver</FullText>
    			</SearchCriteria>
    		
    This example would return all content objects where the appropriate field contains the phrase "heart disease" AND the word "liver".
  • The ByTitle element specifies the text to match in the "Regular Title". If the optional attribute IncludeAdditionalTitles is set to true, the search will match "Inverted Titles" and "Additional Titles" as well. This is a substring search not a word-by-word search, so searching for "a" in the title will return many content objects: any content object whose title(s) contains the letter "a".
  • The ByLetter element specifies a letter to filter the search results by. If a content object's Regular Title or Inverted Title begins with the designated letter, the content object will be returned in the results. If the optional attribute IncludeAdditionalTitles is set to true, the search will also match associated titles in the Additional Title table that begin with the designated letter as well. This element also recognizes "#" as a valid letter and will return content objects that begin with a number if specified.
  • The PostingDate element specifies the date to match in the content's PostingDate field. The format of this content is defined by the XML Schema and is in the format YYYY-MM-DD.
  • The EndPostingDate element, specified with the PostingDate element, defines a range of dates to match in the content's PostingDate field. If EndPostingDate is specified but PostingDate is not, EndPostingDate is ignored. If PostingDate is specified but EndPostingDate is not, the date must match exactly. If they are both specified, the date must be between the two supplied dates.
  • The Language element specifies the language of the content objects to match. See Language Codes for a list of currently supported language codes.
  • The Gender element specifies the gender to match in the content's Gender field. Current options for this element are "All", "Female", and "Male". Specifying "All" is different than leaving this element out. When <Gender>All</Gender> is specified, only those content objects which apply to both men and women are returned. If the criterion is omitted, content objects which apply to just men, just women or men and women are returned.
  • The AgeGroups element specifies the age categories to limit the search by. Current options for AgeGroup are:
    • Infant (0 - 11 mo)
    • Childhood (11 mo - 12 yrs)
    • Teen (12 - 18 yrs)
    • Adult (18+)
    • Senior
    Multiple age groups can be supplied and content can be mapped to multiple age groups. For instance if the search is limited to "Senior", and a particular content object was mapped to Teen, Adult and Senior, it would be returned, but content mapped only to Adult would not. If the search criteria were both Infant and Childhood, and content was mapped to Childhood and Teen, it would be returned.
  • The ContentTypes element specifies the list of ContentTypeIds to limit the search by. Multiple ContentType elements can be used. For instance, to search only through news, use <ContentTypes><ContentType ContentTypeId="6"/></ContentTypes>. To search through news and the wellness library, use <ContentTypes><ContentType ContentTypeId="6"/> <ContentType ContentTypeId="1"/></ContentTypes>. A list of all available content type IDs can be provided on request.
  • The Subtopics element allows limiting the search to certain standard collections or certain subtopics within standard collections. If the RootSubtopicId attribute is specified, the entire collection is searched. If the SubtopicId attribute is used, only content objects within that subtopic (but no child subtopics) are searched. The RootSubtopicIds can be obtained from the ListCollections and ListDynamicCollections method on Content.svc. Any number of Subtopic elements can be included in the search request. If a document is part of at least one of the referenced subtopics (or collections) it is included in the results as long as it matches the other specified criteria.
  • The MeSHList element specifies the list of MeSH Unique IDs to limit the search by. Multiple MeSH elements can be specified; the results will include all content objects that match at least one of the supplied MeSH Unique IDs.
  • The ICD9List element specifies the list of ICD9 codes to limit the search by. Multiple ICD9 elements can be specified; the results will include all content objects that match at least one of the supplied ICD9 codes.
  • The CPTList element specifies the list of CPT codes to limit the search by. Multiple CPT elements can be specified; the results will include all content objects that match at least one of the supplied CPT codes.
  • The Servicelines element specifies the list of Serviceline data to limit the search by. The three attributes (ServicelineKeyword, PageKeyword, and Audience) are all optional. The search results will include all content objects that match at least one of the supplied Servicelines, if more than one is specified.
  • A Paging element can be used in the request to limit the number of items to be returned in pages. <Paging PageNumber="1" PageSize="10" />. Where PageNumber tells the web service which page of data to return and PageSize is used to specify the number of content objects per page.
    If the Paging element is included in the request, the result XML will include paging information in the ContentList element as shown in the example below.

Search Request template

http://external.ws.staywell.com/[SiteName]/Content.svc/SearchContent?xmlRequest=[SearchCriteria]

Sample values for [SearchCriteria]

Return all licensed content containing the words "pain" and "angina"
<SearchCriteria><FullText LogicalOperator="And">pain angina</FullText></SearchCriteria>

Return all licensed content containing either "pain" or "angina" or both:
<SearchCriteria><FullText LogicalOperator="Or">pain angina</FullText></SearchCriteria>

Return all licensed content containing "heart" in the title:
<SearchCriteria><ByTitle>heart</ByTitle></SearchCriteria>

Return all licensed content of ContentType 1 or 2:
<SearchCriteria><ContentTypes><ContentType ContentTypeId="1"/><ContentType ContentTypeId="2"/></ContentTypes></SearchCriteria>

Return all licensed content with a PostingDate of January 1, 2004:
<SearchCriteria><PostingDate>2004-01-01</PostingDate></SearchCriteria>

Return all licensed content of ContentType 1 containing "heart" in the title and "pain" in the body:
<SearchCriteria><ContentTypes><ContentType ContentTypeId="1"/></ContentTypes><Title>heart</Title> <FullText LogicalOperator="And">pain</FullText></SearchCriteria>

Return all licensed content in the Diseases and Conditions Encyclopedia collection (RootSubtopicId 32) with the string "eat" in the title:
<SearchCriteria> <ByTitle>eat</ByTitle> <Subtopics> <Subtopic RootSubtopicId="32"/> </Subtopics> </SearchCriteria>

Sample Search Request

http://external.ws.staywell.com/[SiteName]/Content.svc/SearchContent?xmlRequest=<SearchCriteria><ByTitle>heart</ByTitle></SearchCriteria>

Sample Result XML

<?xml version="1.0" encoding="utf-8"?>
<ContentList PageNumber="1" PageSize="10" TotalPages="5" TotalContent="53">
	<ContentObject ContentObjectType="Document" ContentTypeId="1" ContentId="1" IsCustom="false" ViewCount="6">
		<Language Code="en"/>
		<RegularTitle>Helping the Heart Through Cardiac Rehab</RegularTitle>
		<Gender>All</Gender>
		 <Rating Count="1" Total="4" Average="4" />
	</ContentObject >
	<ContentObject ContentObjectType="StreamingMedia" ContentTypeId="1" ContentId="12" IsCustom="false" RunningTime="120" ViewCount="6">
		<Language code="en"/>
		<RegularTitle>Heart Quiz for Women Only</RegularTitle>
		<Blurb>
			<p>What do you know about a woman's heart?</p>
		</Blurb>
		<Gender>Female</Gender>
		 <Rating Count="1" Total="4" Average="4" />
	</ContentObject >
	<ContentObject ContentObjectType="Document" ContentTypeId="6" ContentId="514918" IsCustom="false" ViewCount="6">
		<Language code="en"/>
		<RegularTitle>New Hope for People With Heart Failure</RegularTitle>
		<Gender>All</Gender>
		<PostingDate>2003-09-03T00:00:00.0000000-06:00</PostingDate>
	<Rating Count="1" Total="4" Average="4" />
	</ContentObject >
	<ContentObject ContentObjectType="StreamingMedia" ContentTypeId="22" ContentId="ClientHeart" ThumbnailId="1234" RunningTime="680" IsCustom="true" Owner="ClientSiteName" RunningTime="120" ViewCount="6">
		<Language code="en"/>
		<RegularTitle>Visit Our Heart Health Center</RegularTitle>
		<Gender>All</Gender>
		 <Rating Count="1" Total="4" Average="4" />
	</ContentObject >
</ContentList >