search

Create a Service Tile for an API from IBM API Connect on Bluemix


In this post I am going to show you how easy it is for you to create a Bluemix tile for an API that you created using IBM API Connect. When you create APIs with IBM API Connect the credentials and urls for accessing your services are published in the developer portal that is tied to the catalog that you used to publish your APIs. Now what happens if you don’t want to embed or create special environment variables to store your credentials for your application, but instead want to use the VCAP_ENVIRONMENT variable to hold the credentials. Fortunately you can create a CloudFoundry user provided service that contains the credentials for accessing your service. This enables you to access the credentials just like you would any other Bluemix service. To do this all you need to do is to use the cf cups command. Here are the steps:

  1. Copy your API’s URL, client_id, and client_secret from the developer portal tied to your catalog. You can find this information from the “API Products” and “Apps” tabs from the developer portal as shown in these screenshots.
    Application Credentials

    Application Credentials

    API URL

    API URL

  2. Run the cf cups command from your command line and pass in the parameters as shown below where you substitute your values for: API-NAME, ID, and SECRET.

    cf cupsĀ API-NAME -p ‘{“url”: “API-URL”, “client_id”: “ID”, “client_secret”: “SECRET”}’

  3. From the Bluemix dashboard bind your service provided instance to any of your Bluemix applications. Once you bind the service you will be able to see the credentials from the Bluemix dashboard and your application will be able to access the credentials through the VCAP_ENVIRONMENT variable as shown below.

    User Provided API

    User Provided API

As you can see it is pretty simple to publish your API’s credentials to any application on Bluemix.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

close
search
Latest Tweets

Hi, guest!

settings

menu