Working with Path and Query Parameters
Path and query parameters are supported in TIBCO BusinessWorks Container Edition REST APIs. Path parameters can be applied only at the root level when they apply to all operations. They cannot be defined for individual operations only. Query parameters can be applied at root as well as at individual operation level.
Define parameters in the resource service path by enclosing each parameter in { } brackets. For example, to define the path parameter isbn for a book resource, specify the resource path as follows:
/book/{isbn}
In this example, the client would invoke this service using the URL http:/<host>:<port>/book/<isbn>.
Insert a question mark (?) after a parameter to add query parameters to a resource. In the following example, isbn is defined as a query parameter, instead of the path parameter, in the resource service path:
/book?{isbn}
Insert (&) to use it as a delimiter when defining multiple query parameters. In the following example, the query parameters isbn and authorName are defined in the resource service path:
/book?{isbn}&{authorName}
All the parameters defined in the resource service path are made available to the user as Input for every operation. See the following image for the /book/{isbn} example to see the Input for the GET operation.
/books/{isbn}?{isbn}
If the Request Format for a REST Binding is Form, the parameter name must be different from all element names in the referenced schema. For example if a Books schema contains the element isbn, isbn can not be used as query or path parameter name.
use: /books/Emma?author,isbn,price
not: /books/Emma?fields=author,isbn,price
Adding or Editing Path Parameters
You can create or modify path parameters for REST services that were created in the TIBCO Business Studio for BusinessWorks using an XSD. For REST services that were created using a Swagger file that was imported from an external source, you can only view the parameters that its operations support. You cannot create or modify the parameters for such services.
Procedure
Adding or Editing Query Parameters
You can create or modify query parameters for REST services that were created in the TIBCO Business Studio for BusinessWorks using an XSD. For REST services that were created using a Swagger file that was imported from an external source you can only view the parameters that its operation supports. You cannot create or modify the parameters in such services.
Procedure
- Click Components under the Module Descriptors to open the Component Configurations page.
- Expand the Component<application_name> node.
- Double-click the process name (with the green chevron next to it) to open its properties in the Properties view.
- Click the Bindings tab.
- Click an operation name in the Operations section.
- Click the Request tab in the Operation Details section.
- Click the green icon () to add a query parameter. To edit the parameter name click on the newly created parameter's default name and type in a new name. Be aware that these buttons will be disabled if you are viewing operations in an API that was created outside the TIBCO Business Studio for BusinessWorks and imported into the TIBCO Business Studio for BusinessWorks.
- You can also edit the existing query parameter to make it required or optional by clicking in the cell that corresponds to the parameter in the Required column. The value toggles from Yes to No or vice versa.