Reputation: 4941
data-encode-url in R
curl "https://www.zopim.com/api/v2/chats/search" \
-G --data-urlencode "q=timestamp:[2016-02-02T16:00:00 TO *] \
-v -u {email_address}:{password}
How to convert --data-urlencode
this in R?
This is what I have so far: without the search part
chats <<- getURL('https://www.zopim.com/api/v2/chats/', verbose = TRUE, userpwd = "username:pwd", httpauth = 1L)
where and how to add
--data-urlencode "q=timestamp:[2016-02-02T16:00:00 TO *]
in R?
Upvotes: 4
Views: 505
Reputation: 78792
library(httr)
GET(
"https://www.zopim.com/api/v2/chats/search",
query=list(
q="timestamp:[2016-02-02T16:00:00 TO *] AND rating:good"
),
authenticate("[email protected]", "yourpassword"),
verbose()
) -> result
content(result, as="parsed")
## $results
## list()
##
## $count
## [1] 0
##
## $prev_url
## NULL
##
## $next_url
## NULL
Remove the verbose()
in production.
Upvotes: 5