Exploring IBM Integration Bus on Cloud by using a sample

Before you upload a BAR file to IBM® Integration Bus on Cloud, you can see how it works by using the provided sample.

About this task

A sample is provided with IBM Integration Bus on Cloud that manages a customer registry with IBM Integration Bus REST services. You download the sample BAR file to your file system, then upload it to IBM Integration Bus on Cloud to create an integration. After you start the integration, you use REST API requests to view and update the details of fictional customers.

Procedure

To use the sample integration, complete the following steps.

  1. When you sign in to IBM Integration Bus on Cloud for the first time, click Explore sample integrations.

    If you want to explore the sample integrations later, click Add integration in the integrations view, then click Why not try exploring some samples?.

    The sample integration is called Manage a customer registry with IBM Integration Bus REST services.
  2. Click Download BAR file and save it to your local file system.

    The BAR file is called CustomerDatabaseV1.bar.

  3. Click Integrations to open the integrations view.
  4. Click Add integration, then Upload your BAR file.
  5. Navigate to the downloaded BAR file in your file system, then click Open.
  6. Click Save to create the integration.

    The BAR file is prepared. When the integration is ready to start, the status changes to Stopped.

  7. To start the integration, click Start Start icon.

    You can see in the integrations view that the integration is running.

  8. Click the integration to show more details.
  9. Expand the Public Endpoints section, and expand the CustomerDatabaseV1 REST API.
  10. Next to /customerdb/v1/customers, click Show full URL.

    The full URL for this customer database is a concatenation of the integration host name and the location of the database.

  11. Copy this URL to a browser to get a list of all the customer records in the database.
    To get a single customer record, append the customer ID to the end of the URL in the format /3.
  12. You can make POST and PUT requests to the integration by using a REST client. Use a POST request to add a customer. Use a PUT request to update the details of a specific customer.
    For example, to add a customer, use a POST request. Use the full URL that is shown in the Public Endpoints section. The body of the POST request is a JSON object. The ID is generated automatically.
    POST https://hostname/customerdb/v1/customers
    {
    "firstname" : "John",
    "lastname" : "Doe",
    "address" : "123 Main Street"
    }
    To update the information for an existing customer, use a PUT request. Specify in the URL the ID of the record that you want to update. In the following example, you are updating record 3. The ID is optional in the body of the PUT request, but if you include the ID, it must match the existing record.
    POST https://hostname/customerdb/v1/customers/3
    {
    "id" : "3",
    "firstname" : "John",
    "lastname" : "Doe",
    "address" : "123 Main Street"
    }

What to do next

When you have seen how IBM Integration Bus on Cloud works, you can upload your own BAR files by following the instructions in Running integrations in the cloud.