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





Store Article Views Code Samples

Use the code samples below as examples to create an application in your desired language.  The following code samples use the /user/article-views endpoint which allows you to post article views.  Get started and begin to understand the endpoint by following the examples below in the language of your choice. 


Code Samples

# Store multiple article view events.

curl -X POST ""
    -H "authorization: Bearer TOKEN"
    -H "Content-Type: application/json"
    -H "Accept: application/json"
    -d "{\"items\":[{\"article\":{\"id\":\"T116388\",\"section \":{\"title\":\"Overview\"},\"title\":\"Acute Lymphoblastic Leukemia/Lymphoma (ALL)\"},\"eventType\":\"OPEN_ITEM\",\"prevSearchTerm\":\"search:covid\"\",\"timestamp\":\"2020-10-19T19:04:03Z\"}]}"

// Store multiple article view events.

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

// Create the URL
HttpUrl url = new HttpUrl.Builder()

// Build the body
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"items\":[{\"article\":{\"id\":\"T116388\",\"section \":{\"title\":\"Overview\"},\"title\":\"Acute Lymphoblastic Leukemia/Lymphoma (ALL)\"},\"eventType\":\"OPEN_ITEM\",\"prevSearchTerm\":\"search:covid\"\",\"timestamp\":\"2020-10-19T19:04:03Z\"}]}")

// Build the request
Request request = new Request.Builder()
    .addHeader("authorization, "Bearer TOKEN")
    .addHeader("Content-Type, "application/json")
    .addHeader("Accept, "application/json")

// Send the request
Response response = client.newCall(request).execute();

// Store multiple article view events.

const host = "";
const path = "/medsapi-dynamed/v1/user/article-views";

// Create the Request
const url = host + path;
const requestBody = {"items":[{"article":{"id":"T116388","section ":{"title":"Overview"},"title":"Acute Lymphoblastic Leukemia/Lymphoma (ALL)"},"eventType":"OPEN_ITEM","prevSearchTerm":"search:covid\"","timestamp":"2020-10-19T19:04:03Z"}]}

const settings = {
    "async": true,
    "crossDomain": true,
    "url": url,
    "method": "POST",
    "headers": {
        "authorization": "Bearer TOKEN",
        "Content-Type": "application/json",
        "Accept": "application/json"
    "processData": false,
    "data": JSON.stringify(requestBody)

// Send the Request
$.ajax(settings).done(function (response) {

# Store multiple article view events.

# Form the URL
urlstr = File.join("https://", "", "/medsapi-dynamed/v1/user/article-views")
url = URI.parse(urlstr)

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

# Create the request
request =
request["authorization"] = "Bearer TOKEN"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request.body = {"items":[{"article":{"id":"T116388","section ":{"title":"Overview"},"title":"Acute Lymphoblastic Leukemia/Lymphoma (ALL)"},"eventType":"OPEN_ITEM","prevSearchTerm":"search:covid\"","timestamp":"2020-10-19T19:04:03Z"}]}

# Send the request
response = http.request(request)

# Store multiple article view events.

# Form the URL
url = "/medsapi-dynamed/v1/user/article-views"

# Payload
payload = "{\"items\":[{\"article\":{\"id\":\"T116388\",\"section \":{\"title\":\"Overview\"},\"title\":\"Acute Lymphoblastic Leukemia/Lymphoma (ALL)\"},\"eventType\":\"OPEN_ITEM\",\"prevSearchTerm\":\"search:covid\"\",\"timestamp\":\"2020-10-19T19:04:03Z\"}]}

# Create Connection Instance

conn = http.client.HTTPSConnection("") 

# Create the Request Headers 
headers = { "authorization": "Bearer TOKEN", "Content-Type": "application/json", "Accept": "application/json" } 

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