Your IPv4 address:
Operating system:

JSON vs XML APIs

When you build or consume an API, the choice between JSON and XML is usually made by the API’s contract and not by taste. The two formats describe the same data in different ways. Neither changes how HTTP status codes, errors and retries have to be handled.

How the two formats differ

JSON maps naturally to the object and array data models of common programming languages and is usually compact: {"ip": "192.0.2.1"}. XML wraps values in named elements, <ip>192.0.2.1</ip>, and supports attributes, namespaces and mature schema tooling for validating documents. Choose from the API contract and the ecosystem around it. Neither format is universally faster or more correct.

What the client must handle in either format

JSON versus XML does not change HTTP semantics. Validate the Content-Type, the status code, the documented fields and your quota. Distinguish success, validation errors, authentication failures, rate limits and temporary server errors, because each calls for a different reaction.

Handle HTTP 429 separately. Respect Retry-After when it is supplied, and otherwise use bounded exponential backoff with jitter: wait longer after each failed attempt, up to a cap, with some random variation. Consider idempotency before retrying, so a repeated request cannot perform an action twice. Log request identifiers, status and latency, but never API secrets.

IP addresses inside a response

Preserve IPv4 and IPv6 values without IPv4-length assumptions: an IPv6 address is much longer as text. For a real request and the current API contract, see the 2ip API.