I am trying to query a range of dates from an API in R/Shiny. I use dateRangeInput to specify the range, and the API documentation specifies that the call is:
spuddate, Value should be in the RFC3339 format, Latest date that drilling commenced on the property. Example: spuddate=gt(2006-01-02T15:04:05Z) spuddate=le(2017-03).
How would I do this correctly?
I've tried several methods using anytime and rfc3339 but I keep getting various errors. I suspect it has to be something around the way I structure the input call in server.
#UI - Obviously there are more but for sake of brevity here is the subset
sidebarPanel(
fluidRow(
column(12,
selectizeInput('stateSelect','STATE', choices= paste0(state.abb, sep=''), multiple=FALSE))
),
fluidRow(
column(12,
selectizeInput('directionSelect','HOLE DIRECTION', choices= c('H','V','D','U'), multiple=FALSE))
),
fluidRow(
column(12,
dateRangeInput("dateSelect", label = h3("Spud Date range")))
),
#Server Try So Far -- Obviously there are more but for sake of brevity here is the subset
observeEvent(input$select, {
wellInfo <- GET("https://di-api.drillinginfo.com/v2/direct-access/producing-entities",
add_headers(c('X-API-KEY' = key, 'Authorization' = addToken, 'Accept' = 'text/xml')),
query=list(drilltype = dput(input$directionSelect), state = dput(input$stateSelect),
spuddate = (rfc3339(anytime(input$dateSelect[1])),rfc3339(anytime(input$dateSelect[2]))),
pagesize = 100000))
})
I just want to get the query to go off. It works without the spuddate call (ie just the state and drilltype query). Any help would be appreciated! Thanks.