Guides
Usage and Billing Portal

Spring Boot Java Session API

6min

This sample illustrates setting up an API endpoint using Spring Boot to call the Amberflo Session API and return the session token using the JAVA SDK. This session token can be used for all Customer Usage and Billing Portal apps.

Steps:

  1. Setup Amberflo environment
  2. Setup configuration for service discovery of Amberflo Customer Usage and Billing Portal Session client
  3. Create API Endpoint and controller to return Session ID.

Maven dependencies (check for latest versions):

XML


Setup the environment to configure Amberflo client settings

  1. Setup the environment to configure the Amberflo SDK client settings
  2. Add the following entries to the application.properties file
  3. Set up an environment for service discoverable.
Text

Document image

Java


Setup Amberflo client bean for service discoverability

Make the Customer Usage and Billing Portal Session client be a discoverable service that can be injected as a dependency by Spring Boot configuration. This will return the client instance as a bean.

Java


API Endpoint to return a session token

In most instances, the user or customer ID is passed in a request header. Set IDENTITY_HEADER to this header.

This is a sample REST controller which returns the session token from Amberflo. This session token can be used for any of the Customer Usage and Billing Portal apps.

API Reference Create a session

Java