R/tm1_get_instances.R

Defines functions tm1_get_instances

Documented in tm1_get_instances

tm1_get_instances <- function(adminhost = "localhost", port = "5898", ssl = TRUE) {

  u1 <- ifelse(ssl==TRUE, "https://", "http://")
  u2 <- adminhost
  u3 <- ":"
  u4 <- port
  u5 <- "/"
  u6<- "api/v1/Servers"

  # url development
  url <- paste0(u1, u2, u3, u4, u5, u6)

  #url = "https://localhost:5898/api/v1/Servers"

  httr::set_config(httr::config(ssl_verifypeer = FALSE))
  httr::set_config(httr::config(ssl_verifyhost = FALSE))

  # post request
  tm1_return <-
    httr::GET(url)

  # make it proper
  tm1_instances <- jsonlite::fromJSON(httr::content(tm1_return, "text"))$value

    #return
  return(tm1_instances)



}

Try the tm1r package in your browser

Any scripts or data that you put into this service are public.

tm1r documentation built on Dec. 15, 2020, 5:36 p.m.