Skip to main content
Version: Current

Genesis HTTP Client and external API Integration

The Genesis HTTP Client is designed to simplify integration with external REST services in the Genesis Platform. It provides an intuitive DSL for making HTTP requests, so that you can integrate Request Servers and Event Handlers with external applications.

The key features and benefits are:

  • Seamless Integration. Designed to work seamlessly with Genesis Request Servers and Event Handlers.
  • Flexible Usage. Supports multiple approaches, including direct client usage, annotation-driven approach, and OpenAPI code generation.
  • Comprehensive HTTP Support. Full support for GET, POST, PUT, DELETE.
  • Customizable. Easily configure headers, query parameters, path parameters, and request bodies.
  • Error Handling. Built-in support for retries and error callbacks.
  • Paginated Support. Pagination support for Request Servers.

Versions and compatibility

The Genesis HTTP Client was introduced in version 8.1 of the Genesis Platform. It is compatible with all Genesis applications running on version 8.1 or higher.

important

Ensure your Genesis Platform is updated to at least version 8.1 to use the Genesis HTTP Client.

Basic usage

Here's a quick example of a GET request using the Genesis HTTP Client within a Request Server:

requestReply<Unit, HelloWorld>("HELLO_WORLD") {
val client = GenesisHttpClient()

replySingle {
client.get<HelloWorld> {
url = "http://api.example.com/hello"
query("name", "John")
}.data
}
}

This example demonstrates how to make a GET request within a Genesis Request Server, showcasing the client's seamless integration with Genesis components. In the following sections, we'll explore the core concepts, different usage approaches, and advanced features of the Genesis HTTP Client.