Create a Streaming API from an AsyncAPI Definition

AsyncAPI specification is a format that describes streaming APIs. An API Creator can import an existing AsyncAPI definition to MWARE ESB to create a streaming API using any one of the following protocols.

The API Creator can import the existing AsyncAPI definition by either uploading a file or by providing an Async API URL.

Follow the instructions below to create a Streaming API using an AsyncAPI definition for an existing API:

Step 1 - Design a Streaming API

  1. Sign in to the Publisher.

    https://<hostname>:9443/publisher

    For testing purposes, you can use https://localhost:9443/publisher and admin as the username and password.

  2. Click CREATE API and then click Import AsyncAPI Definition.

    Note

    The CREATE API button will only appear if the user who has signed in has the creator role permission.

    Design New Streaming API

    The following two options to import the AsynAPI definition appears.

    • AsyncAPI URL - If you select this option, you need to provide a URL.
    • AsyncAPI File - If you select this option, click Browse File to Upload and upload a file, which contains an AsyncAPI definition.
  3. Select the way in which you are going to import the AsynAPI definition, and click Next.

    For this example, let's select AsyncAPI URL, provide the following URL, and click Next.

    https://raw.githubusercontent.com/asyncapi/spec/v2.0.0/examples/2.0.0/streetlights.yml

    Import Websocket Streaming API from AsyncAPI URL

  4. Edit the Streaming API information and click Create.

    Note

    The AsynAPI definition of the Streaming API will contain the basic API definition, and will not specify the protocol, such as WebSocket, WebSub, WebHook, SSE, that the API has to use. You need to provide the Streaming API information here.

    For this example, let's design a WebSocket API using the following information.

    Field Sample value
    Name StreetlightsAPI
    Context /streetlights
    Version 1.0.0
    Protocol WebSocket (or any other type of Streaming API)
    Endpoint ws://localhost:8080

    AsyncAPI configuration values

    Now, the StreetlightsAPI API overview page will appear.

    AsyncAPI overview

Step 2 - Configure Topics

Click Topics to navigate to the topics page.

AsyncAPI topics

You will notice that the topics have been created automatically from the AsyncAPI definition specified in the provided URL.

Step 3 - View the AsyncAPI Definition

Click AsyncAPI Definition under API Configurations.

The AsyncAPI definition of the streaming API, which you just created, appears.

WebSocket API AsyncAPI Definition

Now, you have successfully created a Streaming API from an Async API Definition.

Next, publish the API, for more information, see Publish an API.

What's Next?

Learn how to create Streaming APIs from scratch by trying out the following tutorials:

See Also

Top