Make a low-level call to a QGIS Network API.

qgisremote(path, args = NULL, body = NULL, file = NULL,
  host = qgisremote.options("host"), auth = qgisremote.options("auth"),
  as = "parsed")

Arguments

path

the network API request path (a character string)

args

named list or vector of HTTP GET parameters to be added to the request

body

optional content body for POST requests. character strings (including those of class json) and raw vectors are passed as they are, all other types are first converted using jsonlite::toJSON():

  • Simple vectors are realised as JSON arrays, with any names discarded.

  • Higher-dimensional matrices are realised as an array of arrays (row-wise).

  • Unnamed lists are realised as JSON arrays, with the elements of the array themselves being arrays (of length 1).

  • Lists in which at least one element is named are realised as JSON objects, the individual members' values are again arrays of length 1.

  • Data frames are realised as an array of objects (one object per row).

file

optional name of a file on disk from which the content body for POST requests is read (using the httr package's upload_file() feature)

host

optional location of the Network API to use for the request, in host:port format (for default values see qgisremote.options())

auth

optional token for authenticating against the Network API plugin (for default values see qgisremote.options())

as

how the response body of successful requests should be returned by the function: either 'parsed', or as a 'text' or 'raw' vector (see httr::content())

Value

A representation of the response body of the successful API request. If as = 'parsed' (the default), the result type depends on the content-type of the response (see httr::content()), but will typically be one of:

  1. a primitive (such as a numeric or character string)

  2. a list, representing a complex object parsed from a JSON response

  3. an sf geometry object (parsed from a GeoJSON response) If as = 'text' or as = 'raw', returns the full unparsed body of the API response.

See also

qgisremote.options(), httr::content()