1

I am trying to compose an httr::GET query where I must use a bracketed (array) query where the url resembles:

 #target = "http://example.com?abc[]=123"

This strategy does not seem to work:

 baseurl = "http://example.com"
 qy = list(abc="123")
 httr::GET(baseurl,query=qy)

R complains about invalid characters if I try:

qy = list(abc[]="123")

See also: Is array syntax using square brackets in URL query strings valid?

Array in body for httr POST request

jsta
  • 3,216
  • 25
  • 35
  • Its not that the first example throws an error, its that it does not return the same thing as the target. – jsta Jun 15 '15 at 22:13

1 Answers1

3

You should be able to use

GET(url, query = list("abc[]" = 133))
Nick Kennedy
  • 12,510
  • 2
  • 30
  • 52