TIBCO REST Service: How to Work with Template Style Attribute

While working with REST & JSON Plugin in TIBCO BW5, for passing parameters to a REST Service, one can use query, header or template style of parameters to pass any information from the client to the REST Service. While Query and Header style parameters are self-explanatory as per their names; i.e. parameters are passed as part of query string or header respectively; In this TIBCO REST Web Service with Template Style Attribute tutorial, I will talk about Template style parameter passing so that you may understand its usage and applicability.

What is Template Style Attribute?

For any HTTP Get request being sent to a REST Service, when Template Style attribute passing is supported by the REST Service, attributes can be passed as part of the URL string. These template attributes must be defined at Resource level while developing REST service using REST Dispatch and Reply activity from REST Palette.

An Example Usage of Template Style Attribute for REST Service

Whether query, header or template style parameters should be used; varies depending on specific use cases and one has to decide according to its own needs. There is not hard and fast rule but using Template style parameters brings a lot of flexibility for API Developers.

Let’s take An example scenario where Template Style parameters can be used. We will define a simple REST service using REST & JSON Plugin which returns an employee details based on the employee number specified as template parameter.

As you can see in the screenshot below, a template parameter with the name emp_id is specified at Resource level and is associated with the resource path using {emp_id}.
TIBCO REST Web Service with Template Style Attribute tutorial

The above setting for resource means that for any client accessing this REST service to fetch details of employee with employee id 25, URL should be:
http(s)://IP:Port/employee/25

For the binding of this template parameter to the inputs of the core implementation process, bind option is used at the method level and this template variable is mapped as shown below:

I will not go into the details of how to implement the core process or how to manipulate the data as that has been already covered in some other tutorials. You can refer to the tutorial how to develop restful service in TIBCO for step by step details for Restful services implementation.

Ajmal Abbasi

Ajmal Hussain Abbasi is Integration Consultant By Profession with 13+ years experience in Integration domain mainly with TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Cloud, TIBCO Flogo, TIBCO Mashery, TIBCO Spotfire, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in various sectors by using his skills in TIBCO Flogo, TIBCO API Management (Mashery), TCI, Tibco Designer, TIBCO Business Studio, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi has experience with MuleSoft ESB as well. Ajmal Abbasi is also experienced in the area of API Management particularly with WSO2 API management platforms. Ajmal Abbasi is also experienced in developing solutions using Core Java and J2EE Technologies. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn - YouTube

Leave a Reply

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