Browse our guides and interact with our API reference for more information about MEDSAPI Dynamic Health. Try MEDSAPI Dynamic Health and learn about core concepts.

 

 

 

 

Search Code Samples

Use the code samples below as examples to create an application in your desired language.  The following code samples use the /search endpoint which allows you to execute a search request.  Get started and begin to understand the endpoint by following the examples below in the language of your choice. 

 

# Search Dynamic Health:

curl -X POST "https://apis.ebsco.com/medsapi-dynamic-health/content/search" -H "accept: application/json" 
-H "Authorization: Bearer " -H "x-forwarded-host: www.dynahealth.com" -H "Content-Type: application/json" 
-d "{ \"query\": \"heart attack\", \"pageSize\": 1, 
\"fields\": [ \"title\" ]}"

// Search Dynamic Health:

// Construct the client
OkHttpClient client = new OkHttpClient();

// Create the URL
HttpUrl url = new HttpUrl.Builder()
    .scheme("https")
    .host("apis.ebsco.com")
    .addPathSegment("medsapi-dynamic-health")
    .addPathSegment("v1")
    .addPathSegment("content")
    .addPathSegment("search")
    .build();

// Build the body   
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \"query\": \"heart attack\", \"pageSize\": \"1\", \"fields\": [ \"title\" ]}");  

// Build the request
Request request = new Request.Builder()
    .url(url)
    .post(body)
    .addHeader("Accept", "application/json")
    .addHeader("Authorization", "Bearer TOKEN")
    .addHeader("Content-Type", "application/json")
    .build();
// Search Dynamic Health: 

const host = "https://apis.ebsco.com";
const  path = "/medsapi-dynamic-health/v1/content/search";

// Create the Request
const url = host + path;
const requestBody = {
  "query": "heart attack",
  "pageSize": 1,
  "fields": [
    "title"
  ]
};
const settings = {
  "async": true,
  "crossDomain": true,
  "url": url,
  "method": "POST",
  "processData": false,
  "data": JSON.stringify(requestBody),
  "headers": {
        Accept: "application/json",
        Authorization: "Bearer TOKEN",
        "Content-Type": "application/json"
  }  
}

// Send the Request
$.ajax(settings).done(function (response) {
  console.log(response);
});
# Search Dynamic Health

# Form the URL 
urlstr = File.join('https://', 'apis.ebsco.com', '/medsapi-dynamic-health', '/v1/content/search')
url = URI(urlstr)

# Create the HTTP object
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

# Create the request
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Bearer TOKEN"
request["Content-Type"] = "application/json"
request.body = { query: 'heart attack', pageSize: '1', fields: [ 'title' ]}.to_json

# Send the request
response = http.request(request)
# Search Dynamic Health

# Form the URL
url = ''.join(['/medsapi-dynamic-health','/v1', '/content/search'])

# Create Connection Instance
conn = http.client.HTTPSConnection("apis.ebsco.com")

# Payload
payload = '{"query":"heart attack","pageSize":1,"fields":["title"]}'

# Create the Request Headers
headers = {
    "Authorization": "Bearer TOKEN",
    "Accept": "application/json",
    "Cache-Control": "no-cache",
    }

# Send Request  
conn.request("POST", url, payload, headers)