InsionInsion
Java

Errors and raw responses

Handle API exceptions and inspect HTTP response metadata

The client throws InsionApiApiException when an API request fails.

try {
  client.deleteARecord(DeleteApiV1IngestRequest.builder().clientId("post-123").build());
} catch (InsionApiApiException error) {
  // Inspect the API exception and handle the failure.
}

Use withRawResponse() when you need headers or the status code. Its methods return InsionApiHttpResponse<T>; call body() for the same parsed value returned by the normal client.

var response = client.withRawResponse().listRecords();
var records = response.body();
var headers = response.headers();