Parse the body of a response with httr2::resp_body_json(), extract a named
subset of that body, and tidy the result with tibblify::tibblify().
Arguments
- resp
(
httr2_response) A singlehttr2::response()object (as returned byhttr2::req_perform()).- spec
(
tspecorNULL) A specification used bytibblify::tibblify()to parse the extracted body ofresp. WhenspecisNULL(the default),tibblify::tibblify()will attempt to guess a spec.- unspecified
(
length-1 character) A string that describes what happens if the extracted body ofrespcontains fields that are not specified inspec. Whiletibblify::tibblify()defaults toNULLfor this value, we set it tolistso that the body will still parse whenrespcontains extra data without throwing errors.- subset_path
(
character) An optional vector indicating the path to the "real" object within the body ofresp. For example, many APIs return a body with information about the status of the response, cache information, perhaps pagination information, and then the actual data in a field such asdata. If the desired part of the response body is indata$objects, the value of this argument should bec("data", "object").