getURLcheckStatus: Get URL and check status

View source: R/JSON_library.R

getURLcheckStatusR Documentation

Get URL and check status

Description

This is a wrapper for getURL that throws an error when the HTTP status is 400 or greater, or possibly when the response is html.

Usage

getURLcheckStatus(url, ..., requireJSON = FALSE)

postURLcheckStatus(url, postfields, ..., requireJSON = FALSE)

putURLcheckStatus(url, postfields, ..., requireJSON = FALSE)

deleteURLcheckStatus(url, ..., requireJSON = FALSE)

Arguments

url

the url to get/post

...

optional parameters passed to getURL

requireJSON

boolean if errors should be thrown on JSON

postfields

data sent to the server

Details

Checks the HTTP status and logs to racas.log as com.acas.sel if 400 or greater. Setting requireJSON to TRUE will add a check for if the response is HTML (but not necessarily valid JSON). POST, PUT, and DELETE can be done with their own functions. In POST and PUT, the postfields will also be logged. Within racas, postfields is usually JSON.


mcneilco/racas documentation built on April 19, 2024, 1:12 p.m.