Search Suggestions
Basic Search
The Dynamic Health API GET /content/search/suggestions endpoint returns a list of completed phrases that contain the term (or partial term) supplied in the query parameter. The /content/search/suggestions endpoint is useful for providing autocomplete suggestions to users searching the Dynamic Health content set. The endpoint attempts to returns two types of suggestions: title suggestions and term suggestions by default. In a title suggestion, the completed phrase is the title of an article containing the query term. Title suggestions are returned to all users of Dynamic Health. In a term suggestion, the completed phrase is a term or phrase that can be used with the GET /content/search endpoint to search the content in Dynamic Health. Only users with access to Dynamic Health's clinical decision support content will receive term suggestions in response to a GET /content/search/suggestions request. The /content/search/suggestions endpoint provides four parameters for specifying the search criteria: the query term, pubTypeGroup, completionType and the max number of results to return for each suggestion type. The query term is required and may be a single letter or partial word. If only term or only title resposes are desired, that can be requested with the completionType . The pubTypeGroup returns responses that only are found in that publication type(s).
To Perform a Search Suggestions Query (example):
Gather the following information for the request:
- An access token. Please see Use the Client Credentials Grant for further information.
- A word or phrase to search for suggestions. It may be a single letter or partial word.
Request
https://apis.ebsco.com/medsapi-dynamic-health/v1/content/search/suggestions?query=be&maxItemsPerSuggestionType=1
The request above is for suggestions for the partial term be. The request specifies that the endpoint should return no more than 1 suggestion per suggestion type (term/title).
Response
{ "_metadata": { "links": [ { "rel": "self", "href": "https://apis.ebsco.com/medsapi-dynamic-health/v1/content/search/suggestions?query=be&maxItemsPerSuggestionType=1" } ] }, "items": [ { "suggestionType": "title", "suggestions": [ { "completedPhrase": "Bed Bug Bites", "resource": { "id": "T900607", "slug": "/condition/bed-bug-bites", "links": [ { "rel": "self", "href": "https://apis.ebsco.com/medsapi-dynamic-health/v1/content/articles/T900607" } ] } } ] }, { "suggestionType": "term", "suggestions": [ { "completedPhrase": "bed bugs", "links": [ { "rel": "search", "href": "https://apis.ebsco.com/medsapi-dynamic-health/v1/content/search", "method": "POST", "request": { "query": "bed bugs" } } ] } ] } ] }
Error Response Codes
The Dynamic Health get search suggestions endpoint can return one of the error response codes.