Skip to contents

This function takes an API response object and converts its JSON body to a data frame if the response contains a body. If the response does not contain a body, a warning is issued with the response status code.

Usage

resp_body_json_to_df(api_response)

Arguments

api_response

Response object from the API, expected to be of class httr2_response.

Value

A data frame containing the JSON content of the response body if it exists; otherwise, NULL.

Examples

if (FALSE) { # interactive()
response <- ecopi_api("GET /detections/", params = list("project" = "017_neeri"))
resp_body_json_to_df(response)
}