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

 

 

 

 

Fetch Transfer Token Code Samples

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

 

Code Samples

cURL
# Fetch a transferToken

curl -X POST "https://apis.ebsco.com/medsapi-dynamed/api/v1/user/transfer-token?toProductId=dcd"
    -H "Authorization: Bearer Token"
    -H "x-eis-id-token: ID Token"
    -H "Content-Type: application/json"
    -H "Accept: application/json"


Java
// Fetch a transferToken

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

// Create the URL
HttpUrl url = new HttpUrl.Builder()
    .scheme("https")
    .host("apis.ebsco.com")    
    .addPathSegment("medsapi-dynamed")
    .addPathSegment("api")
    .addPathSegment("v1")
    .addPathSegment("user")
    .addPathSegment("transfer-token")
    .addQueryParameter("toProductId", "dcd")
    .build();

// Build the body
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}")

// Build the request
Request request = new Request.Builder()
    .url(url)
    .post(body)
    .addHeader("Authorization", "Bearer Token")
    .addHeader("x-eis-id-token", "ID Token")
    .addHeader("Content-Type", "application/json")
    .addHeader("Accept", "application/json")
    .build();

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

JavaScript
// Fetch a transferToken

const host = "https://apis.ebsco.com";
const path = "/medsapi-dynamed/api/v1/user/transfer-token";

// Create the Request
const url = host + path;
const queryParams = {"toProductId": "dcd"}
const requestBody = {}

const settings = {
    "async": true,
    "crossDomain": true,
    "url": url,
    "method": "POST",
    "headers": {
        "Authorization": "Bearer Token",
        "x-eis-id-token": "ID Token",
        "Content-Type": "application/json",
        "Accept": "application/json"
    },
    "processData": false,
    "data": JSON.stringify(requestBody)
};

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

Ruby
# Fetch a transferToken

# Form the URL
urlstr = File.join("https://", "apis.ebsco.com", "/medsapi-dynamed/api/v1/user/transfer-token")
url = URI.parse(urlstr)
params = { :toProductId => "dcd"  }

# 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["Authorization"] = "Bearer Token"
request["x-eis-id-token"] = "ID Token"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request.body = {}

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

Python
# Fetch a transferToken

# Form the URL
url = "/medsapi-dynamed/api/v1/user/transfer-token"

queryParams = {
        "toProductId": "dcd"}

# Payload
payload = {}

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

# Create the Request Headers
headers = {
        "Authorization": "Bearer Token",
        "x-eis-id-token": "ID Token",
        "Content-Type": "application/json",
        "Accept": "application/json"
}

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