Response Handling

APIs return data in varied formats — JSON, XML, CSV, plain text — each with its own extraction toolchain. The patterns in this section are vendor-agnostic. They work against any API on the internet, whether you are scripting with curl or building automation with netapi.

What you will find here

JSON Extraction with jq

Most modern APIs return JSON. jq is the standard tool for extracting, filtering, and reshaping JSON at the command line.

XML Extraction

Legacy APIs (SOAP, Cisco MnT, many enterprise platforms) still return XML. xmlstarlet and yq handle the heavy lifting.

Pagination Strategies

Any API returning collections will paginate. Offset, cursor, link-header, and keyset strategies each require different loop patterns.

Guiding principle

The goal is always the same: reduce an API response to the exact fields you need, in a format your next tool can consume. Master the extraction tool and every API becomes a data source, not an obstacle.