Chapter 3. Viewing, publishing, and discovering the Task API quickstart

The Task Management API quickstart helps you to quickly learn how to configure, publish, and test an API provider integration.

The Task Management API example simulates a simple API that sales consultants might use to track the tasks that they need to do when interacting with customer contacts. Example "to-do" tasks might be "create an account for a new contact" or "place an order for an existing contact".

3.1. Overview of steps for the Quickstart

  1. Optionally, if you want to view the API in the Apicurito web-based designer, import the provided OpenAPI JSON file.
  2. Import the provided ZIP file and edit the API operation return codes.
  3. Publish the Fuse Online integration as an API service to make it available on OpenShift.
  4. In 3scale API Management, discover the published API service.

3.2. Before you begin

Go to https://github.com/syndesisio/syndesis-quickstarts/tree/master/api-provider and download task-api.json and TaskAPI-export.zip.

3.3. Viewing the API in Apicurito

  1. In Fuse Online, in the left navigation panel, click Integrations.
  2. Click Create Integration.
  3. For the Start Connection, click the API Provider card.
  4. For the Upload an OpenAPI file, drag and drop the task-api.json file that you downloaded. Fuse Online indicates that it has successfully imported the file.
  5. Click Next.
  6. Click Review/Edit.

    The API opens in Apicurito.

  7. Explore the structure of the API. Note that it has two paths - one for tasks and one for a specific task - and three operations to create a task, retrieve a task by its ID, and delete a task by its ID.

    To save time, rather than building the integration from the OpenAPI specification, you can use the already built integration that is also provided with the quickstart download.

  8. Cancel and confirm the cancellation until you return to the Fuse Online dashboard.

3.4. Importing and completing the Task API integration in Fuse Online

  1. To import the quickstart:

    1. In Fuse Online, in the left navigation panel, click Integrations.
    2. In the upper right, click Import.
    3. Drag and drop the TaskAPI-export.zip file that you downloaded. Fuse Online indicates that it has successfully imported the file.
  2. In the left navigation panel, click Integrations to see an entry for the Task API integration that you just imported. The entry indicates that configuration is required.

    Connections and steps have already been added to this flow. In the operation flow visualization panel on the left, move your cursor over the icons to see what they represent. Click a step to view its configuration. When you are done examining one, click another one to examine it. When you click a database connection, you can see the SQL statement that it executes.

  3. To open the integration editor:

    1. Click the Task API entry to display its summary.
    2. In the upper right, click Edit Integration to display a list of the operations that this API provides.
  4. To configure the flow for the Create Task operation:

    1. Click the POST entry for the Create Task operation.
    2. In the operation flow visualization panel on the left, click the Provided API Return Path icon at the bottom. You might have to scroll down to see it. When you hover over it, Fuse Online displays Provided API Return Path.
    3. Click the Return Code input field and scroll to select 201 Created.
    4. Click Next, and then click Save.
    5. At the top, to the right of Operations, click the down arrow and then click Go to Operations List.
  5. Repeat step 4 for the Delete and Get operations to change the return codes from 501 to 200.

3.5. Publishing the integration in Fuse Online

  1. Save the integration.
  2. In the upper right, click Publish.

    Fuse Online displays the integrations list page and shows publication progress as it assemblies, builds, deploys, and starts the integration.

When the entry for the Task API integration displays Running, it is available for discovery by 3scale.

3.6. Discovering the published API in 3scale

  1. Log in to the 3scale Administration Portal.
  2. From the Admin Portal’s Dashboard, click New API.
  3. Choose Import from OpenShift.
  4. In the Namespace field, specify or select the OpenShift project that contains the API, for example fuse.
  5. In the Name field, type or select the name of an OpenShift service within that namespace, for example i-task-api.
  6. Click Create Service.
  7. Wait for the new API service to be asynchronously imported into 3scale. A message appears in the upper right section of the Admin Portal: The service will be imported shortly. You will receive a notification when it is done.

3.7. Next steps

See the Red Hat 3scale API Management documentation for information about managing the API.