Notice, you must register for an API Key to use as a password. https://midt.meddra.org/account/register
library(jsonlite)
library(dmtools)
# read MedDRA id and API key from a CSV file
read.csv("api_auth.csv", sep = ";")
auth <- "https://midt.meddra.org/connect/token"
url_auth <-# get token
meddra_auth(url_auth, auth$id, auth$api_key) token <-
"https://mapit.meddra.org/api/search"
url_search <-# read a file with a json
read_json("search.txt") %>% toJSON(auto_unbox = T)
json_search <-# get a response
meddra_post(url_search, json_search, token)
list_search <-# response to a tibble
list_parse(list_search) tibble_search <-
"https://mapit.meddra.org/api/hier"
url_hier <-# read a file with a json
read_json("hier.txt") %>% toJSON(auto_unbox = T)
json_hier <-# get a response
meddra_post(url_hier, json_hier, token)
list_hier <-# response to a tibble
list_parse(list_hier$rows) tibble_hier <-
"https://mapit.meddra.org/api/type"
url_type <-# read a file with a json
read_json("type.txt") %>% toJSON(auto_unbox = T)
json_type <-# get a response
meddra_post(url_type, json_type, token)
list_type <-# response to a tibble
list_parse(list_type) tibble_type <-