R

LogHive provides a simple REST API that you can use to push events and errors. Here is an example code for R:

Push Event

library(httr)

url <- "https://api.loghive.app/v1/event/add"
headers <- c(
  "Content-Type" = "application/json",
  "ApiKey" = "YourPersonalApiKey"
)
body <- list(
  project = "yourprojectname",
  group = "yourgroupname",
  event= "yourevent",
  notify= FALSE
)
json_body <- toJSON(body)

response <- POST(url, headers = headers, body = json_body)

status_code <- response$status_code
content <- content(response, as = "text")

Push Insight

library(httr)

url <- "https://api.loghive.app/v1/insight/add"
headers <- c(
  "Content-Type" = "application/json",
  "ApiKey" = "YourPersonalApiKey"
)
body <- list(
  project = "MySaas",
  insight = "system1-online",
  value= 1
)
json_body <- toJSON(body)

response <- POST(url, headers = headers, body = json_body)

status_code <- response$status_code
content <- content(response, as = "text")

Last updated