Skip to content

Commit

Permalink
Merge pull request #5 from tonyfujs/https
Browse files Browse the repository at this point in the history
Make sure all URLs start with https: instead of http:
  • Loading branch information
tonyfujs authored Feb 2, 2021
2 parents 02e1622 + e9d1d34 commit c19884b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions R/connect_mdlib.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#'
#' @param path character: path to send request
#' @param query character
#' @param token character: access token to be obtained from \url{http://microdatalib.worldbank.org/index.php/auth/api_keys}
#' @param token character: access token to be obtained from \url{https://microdatalib.worldbank.org/index.php/auth/api_keys}
#' @param root character: the root url that hosts the API
#'
#' @return object of class mdlib_api
#' @export
#' @importFrom utils str
#'

connect_mdlib <- function(path, query = NULL, token, root = "http://microdatalib.worldbank.org") {
connect_mdlib <- function(path, query = NULL, token, root = "https://microdatalib.worldbank.org") {
# Build request URL
url <- httr::modify_url(root, path = path, query = query)
# Send request to API
Expand Down Expand Up @@ -43,7 +43,7 @@ connect_mdlib <- function(path, query = NULL, token, root = "http://microdatalib


print.mdlib_api <- function(x, ...) {
cat("<http://microdatalibqa.worldbank.org/", x$path, ">\n", sep = "")
cat("<https://microdatalibqa.worldbank.org/", x$path, ">\n", sep = "")
str(x$content)
invisible(x)
}
2 changes: 1 addition & 1 deletion R/get_public_survey_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
get_public_survey_list <- function(token){
out <- connect_mdlib(path = 'index.php/api/catalog/search?ps=10000',
token = token,
root = 'http://microdata.worldbank.org/')
root = 'https://microdata.worldbank.org/')
out <- out$content$result$rows

return(out)
Expand Down
2 changes: 1 addition & 1 deletion R/get_survey_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ get_survey_list <- function(token){

get_number_of_surveys <- function(token) {
# Should be better integrated with the other functions (URL should not be hard coded)
url <- "http://microdatalib.worldbank.org/index.php/api/catalog/search?ps=1"
url <- "https://microdatalib.worldbank.org/index.php/api/catalog/search?ps=1"

resp <- httr::GET(url,
httr::add_headers(.headers = c('X-API-KEY' = token,
Expand Down
4 changes: 2 additions & 2 deletions man/connect_mdlib.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/getting_started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ knitr::opts_chunk$set(
### Before you start: Get your API KEY
You can get your API KEY by:

1. Visiting the [following link](http://microdatalibqa.worldbank.org/index.php/auth/api_keys)
1. Visiting the [following link](https://microdatalibqa.worldbank.org/index.php/auth/api_keys)
1. Loging using your World Bank SecureID token
1. Clicking the __create new key__ button.

API documentation can be accessed [here](http://microdatalibqa.worldbank.org/apidocumentation/#api-Metadata-datafile_variables)
API documentation can be accessed [here](https://microdatalibqa.worldbank.org/apidocumentation/#api-Metadata-datafile_variables)

### List all available surveys
```{r}
Expand Down

0 comments on commit c19884b

Please sign in to comment.