The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now!
A chart showing the TIBCO Platform vision
Jump to content
Articles
Read more about TIBCO use cases, product features, capabilities and more
  • Deploying an API to the Cloud with TIBCO® Cloud Integration


    Deepesh Tiwari

    Table of Contents


    Once you modeled and tested your API, the implementation can start. To get from modeling to implementation and testing your business logic is as easy as dragging and dropping activities.

    Objective

    In this tutorial we will be using TIBCO Business Studio? - Cloud Edition to implement and deploy an API to TIBCO® Cloud Integration without writing code.

    Before you Start

    Login to your TIBCO Cloud Integration account, by going to http://cloud.tibco.com/ and clicking in the Sign-in link at the top of the screen.

    If you do not have an account yet you can start a free 30 day trial from the http://cloud.tibco.com/ page.

    This tutorial is will be using the API we have modeled in Creating my First API on TIBCO Cloud Integration so it assumes that you have already completed that tutorial.

    Starting TIBCO Business Studio? Cloud Edition

    In this tutorial we are going to use TIBCO Business Studio? - Cloud Edition which is included in your TIBCO Cloud Integration subscription.

    Once logged in download TIBCO Business Studio? Cloud Edition for your operating system and install it in your workstation.

    TIBCO Business Studio Cloud Edition is an Eclipse based platform that will enable you to design and create your API workflows and is fully integrated with TIBCO Cloud Integration. Allowing you to publish and work with the all the applications you have deployed in the cloud.

    image28.thumb.png.00a842e4b46c730b4e6fcb85c08d6065.png

    1. The first thing we need to do once we have TIBCO Business Studio running in our workstation is to connect it to out TIBCO Cloud Integration account. To do that we will focus on the API Explorer view.

      image11_0.png.1b4a9a505bca59536ff1995368b2ca50.png 

    2. To do this in the API Explorer View go to the down arrow icon image20_0.png.2b53cb36f2f4b3276769302a34056950.png on the far right side of the windows and select ?Settings?

      image23_0.png.578f4aeef026d04588c6344bda906965.png

       

    3. In this Settings window you will see the  TIBCO Cloud Integration Connection already set up for you. We just need to add our login credentials.

      image26.png.08a999a1b4aee2ca0f264830cadeeade.png

      To do this we select the Cloud Configuration in API Registry Configurations and click image19_0.png.96db4366f1803da6249143ac85b61eeb.png

       

    4. Under Authentication fill in with the same the username and password you use to login to your TIBCO Cloud Integration (http://cloud.tibco.com) account and click Finish.

      image03_2.png.28ad9063f57bf52d9c1e3542287c5e53.png

       

    5. Now the API Explorer will refresh and you should see the list of API Specifications you have modeled on your TIBCO Cloud Integration account. AT this point you should see the Hello World Spec we modeled in the previous Tutorial.

      image27.png.e223c3535cf5184bf598d007a86a1ade.png

    With this taken care of we can move on to build a new application to implement our Hello World API we defined in the previous tutorial.

    Implementing our API Specification

    To implement the API we have defined we need to create a new Application in Business Studio. Just right-click on the Project Explorer window and select New -> BusinessWorks Application

    image04_1.png.86feee721ee1878880437ff2f5198d31.png

      To create the new application we just need a Name, remember that application names can only contain lowercase letters (a-z), numbers (0-9), dots (.) and underscores (_)

    In our case we will choose ?hello_world_app?, just put the name in the new Project dialog and leave all the other options with their default setting, and click FINISH

    image01_1.png.7a8fd9905eb72aabd25aad670ad34bfb.png

    TIBCO Business Studio Cloud Edition will create all the assets needed to start implementing our API in our application.

    image18_0.thumb.png.6cfb46675980277014a4e205cb78a350.png

     

    To start implementing our API we now need to Drag and Drop the API Specification, we already created in our account to our new project

    Now click and Drag the Hello World (1.0) API from the API Explorer Window to the Service Descriptors folder in our project.

    image05_1.png.da1fd1c8da43e56e3fc6c560fd3e5d04.png

    This will import your Specification in your projects and create all the assets needed to start implementing.

    image07_0.png.3f922c3fce22bf9ce29e995a5a9dfe66.png

    As you remember from our previous tutorial our HelloWorld API has a GET method called ?greeting? that will receive a ?name? as a parameter.  And you can see all that in your project now. To implement the response of this method we just need to Drag the resource ?/greeting? into the canvas on the right.

    image02_1.png.09ca71f3493bf666b2e670f6ad5ca091.png

    (Hint: Make sure you drop it outside the Process flow, as marked in the Screenshot)

    Now you can see the implementation of our GET request. In this example implementation we want our API to respond to the /greeting GET request with a string that contains ?Hello ? concatenated to the {name} passed as a parameter.

    This way when we call the method with a parameter i.e. GET ./greeting/World our API will respond with the String ?Hello World?

    image12_0.thumb.png.6eb969cf3d321dd5bdd8adbd824dc8b7.png

    To modify our return response to the get method we simply add a default statement to the activity called getOut.

    Let?s do it!

    1. Select the getOut Activity by clicking on it

      image06_0.png.0239bf8ac4c1746b435b94a1973509a5.png

    2. Now go to the Properties window below and click the Input Tab
    3. Once in the Input Tab Click on XPath Expression next to the returned Item to add our response

      image09_0.png.37ae5c112967519edc6c199295be7708.png

      This expression will be the response to our GET request, remember we want the response to ve the concatenation of the word ?Hello ? and the parameter that was passed in the request.

    4. Let?s build our expression!

      No need to write any code here, just click on Functions and search for ?concat? under String Functions and drag the function to the expression box.

      image17_0.png.e22ba26df13ef0081db994b5ebb72ef6.png

      The concat function is pretty simple just accepts two strings, based on our response the first string should be ?Hello ?. Now go ahead and replace << string1 >> with ?Hello ?

      image24_0.png.613d762ad0e265315eb860945956cd1c.png

      (Hint: don?t forget the quotes in your string ) Now for the second part we need to use the GET request parameter. We can find it in the Data Source Tab by expanding the tree on $get -> parameters -> greetingGetParameters -> name

      Just drag and drop the parameter name over << string2,... >>

      image25_0.png.ee1d36b510f03f1e2b78a0005a1b2681.png

      Your expression is now done! It should look like this:

      image21_0.png.11514d0afde7462068d565c9ba9779cb.png

    5. And we are done!! So go ahead and save your Process by going to the menu and selecting FIle -> Save
    The only thing left to do is to deploy your brand new application to the cloud. How do you do this?

    Very Simple. Just go to the Project Explorer and right click on your Application in our case ?hello_world_app? and select Push to Cloud?

    (Note: Business Studio creates 2 objects in the Project Explorer for you one is the BusinessWorks Application Module that uses this icon image22_0.png.18364d6b6edd46a21e90a383f3fb8e5b.pngand ends.

    And the other object is the actual BusinessWorks Application itself which uses this icon image16_0.png.5477e0aef217f3bec2ab0fee77587c12.png

    image10_0.png.7697f7b8ef2143172be6fe6bed41194d.png

    That?s it! No call to IT no meeting with Cloud Ops, nothing. All is taken care by TIBCO Cloud Integration for you.

    Now again is time to test our Application.

    Go to your TIBCO Cloud Integration account and in the Apps page you will see the Application we just have deployed (hello_world_app) from Business Studio ready to go.

    image00_1.thumb.png.de66702e09746a4cdd20fe0ed10c928d.png

    Remember the Green Circle next to the App name means that the app is deployed and ready.

    Similar to what we did with our Mock-Up application, by clicking on image14_0.png.29cb9958adf06dc00269383aeb4c8d17.png and then on image08_0.png.c85b926016297d5cc8279e283092cfef.png will launch the TCI API tester.

    image15_0.thumb.png.267d827ce0d856817104aae2ee5b2178.png

    Now to test our Response, let?s enter some value in the parameter, like ?Cloud?

    image13_0.png.cc3799d7146d74146e90298d239a5d37.png

    Then click on ?Try it Now!? and you will be able to see your API implementation working!! Returning ?Hello Cloud? in the Response Body

    image29.png.5346f74e789cd1026b4b02ba8f137f26.png


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...