Consume API endpoint via Docker Compose

The consumption of API endpoints is an addition to the default IDS interaction that allows to exchange API endpoints. This allows for existing HTTP services to work over IDS. For this the OpenAPI Data App is used.

The process of consuming an API is as follows:

  1. retrieve metadata of the connector and OpenAPI data app resources,
  2. send the HTTP request to the OpenAPI data app connected to your own connector

The test connector deployed at https://test-connector.playground.dataspac.es/ui/ provides an agent that exposes an test server implementing the https://httpbin.org/ API specification.

Configuration

  • Download templates
  • Provide IDS Identity
    Configure the certificates that you’ve created in the Request Playground Identities step.
    • Make sure the following files are in the same folder as docker-compose.yml: cachain.crt, component.crt, component.key with the PEM-based CA chain, public and private keys
    • Modify info.idsid, info.curator, info.maintainer to the corresponding identifiers that you filled in during creation of the certificates. info.idsid should be the Connector ID, and info.curator, info.maintainer should be the Participant ID.
  • Change Admin User credentials
    The default password is playground but this can be changed to a more secure password, which is especially needed for public Kubernetes deployments.
  • Enable OpenAPI data app
    • Uncomment the OpenAPI block at the bottom of the template.

Deployment

To deploy the TSG Core Container execute:

docker-compose up -d

The containers will be deployed in detached mode, the user interface of the TSG Core Container will be available at: http://localhost:31000

To follow the logs of the TSG Core Container execute:

docker-compose logs -f tsg-core-container

OpenAPI Data App

An OpenAPI Data App is deployed on https://test-connector.playground.dataspac.es. This OpenAPI Data App forwards the requests that are sent to it a service implementing the https://httpbin.org/ API specification.

To test if the deployment worked correctly, visit http://localhost:31001/#/. This contains a very simple form where you can enter a message which is sent to the httpbin OpenAPI data app. If everything is setup correctly, you should see the message you sent being returned in a response.

Deploy your own client

If you want, you can also write a custom client app that communicates with httpbin. For this, you only have to change the image name in the httpbin-ui container. Make sure that your application adds the FORWARD_TO, FORWARD_SENDER, FORWARD_RECIPIENT, FORWARD_ACCESSURL and API_BACKEND headers to its outgoing requests.

This step is especially useful if you are going to provide an API.

Clean-up

If you do not want to proceed with other tutorials, you can remove the resources used.

To clean-up all resources of the playground execute, in the same folder as the docker-compose.yml file:

docker-compose down

Didn't find what you were looking for?