Skip to contents

API responses generally follow a structured format. Use this function to extract the relevant portion of a response, and wrangle it into a desired format. This function is most useful when the response was fetched with a request that includes a tidying policy defined via req_tidy_policy().

Usage

resp_tidy(resps)

Arguments

resps

(httr2_response, nectar_responses, or list) A single httr2::response() object (as returned by httr2::req_perform()) or a list of such objects (as returned by req_perform_opinionated() or httr2::req_perform_iterative()).

Value

The extracted and cleaned response, or, for a list of responses, those responses cleaned then concatenated via httr2::resps_data(). By default, the response is processed with resp_body_auto().

See also

resp_tidy_json() for an opinionated response parser for JSON responses, resp_body_auto() (etc) for a family of response parsers that attempts to automatically select the appropriate parser based on the response content type, httr2::resp_body_raw() (etc) for the underlying httr2 response parsers, and resp_parse() for an alternative approach to dealing with responses (particularly useful if the request does not include a resp_tidy policy).