Not all APIs are created equal and sometimes all you need is to change the behavior of your API a little to cover something very specific. Should you go back to TIBCO Business Studio - Cloud Edition and add that logic (implementing some complex If-Then-Else structures) or is there another way? With the Microflow technology in TIBCO Cloud Integration you can use
stages defined in to change the behavior of APIs without changing the back-end service implementation.
Let's take a simple example where you use the Mock application that you created earlier and add a Microflow to change the behavior of the API. In this case we'll safeguard against overflowing the backend (
Throttling) and change the response (
Application Liston TIBCO Cloud Integration select the
Hamburger Menuof your application and choose to
Applications can have more than one endpoint, so you'll also need to choose which endpoint to add a Microflow to. In this case your application only has one endpoint available so you can pick that one
In the pop-up dialog you'll need to specify a name for your Microflow Application. Something like
MyMicroflowAppwill do nicely.
You'll be directed to the Microflow modeler in which each operation in the API you're adding a Microflow to will have a
Request / Response pipeline diagram. You can add stages that alter the behavior of the API by clicking on the
+symbols of either the Request or Response side.
To safeguard against overflowing the backend click on the
+symbol on the request side of the diagram and select the
You can configure the amount of transactions per second to any value you like and click on
Addto add the stage and to return to the diagram.
To change the response click on the
+symbol on the response side of the diagram and select the
done(res). This will add
from TIBCO Software Inc.at the end of the response it receives from the Mock application.res = res + " from TIBCO Software Inc.";
Note: as you start typing you'll see a blue text Update appear next to the Output JSON. Clicking this button will execute your code and you can see what your transformation does to the input
Addto save the code and return back to the diagram
Back on the Microflow modeling page the
Push updatesbutton is now enabled. You can click it to send the updates you made to the Microflow application. Just like with the Mock application you'll see a progress bar that indicates we're doing the work for you.
Once the process finished and the application is built you will see it on the main screen. The Green Circle next to the App Name means that the app is running and ready to answer requests.
Now that our application is ready and running on the Cloud is time to test it! To test the API you can easily send a message to it by clicking on
Endpoint. With TIBCO® Cloud Integration we even made that easier and added the API Tester which you can get to by clicking
Note: if you do not see your methods click
Show/Hideon the right top menu
Just click on
GETand enter any value in your parameter i.e.
Then click on
Try it Now!and you will be able to see your API working returning a response.