Working with Form Parameters
TIBCO Business Studio supports the use of form parameters as the media type in REST requests for POST, PUT, and PATCH operations. This is the only media type that can be used to transmit files.
Refer to the Conversion Between JSON and XML in TIBCO Business Studio™ section for details on how Form parameters are represented in JSON and XSD.
Form parameters are applicable to POST, PUT, and PATCH operations only. They must be defined at the operation level only and cannot be defined at the binding level.
- Tag/Value (application/x-www-form-urlencoded) - Select this encoding for an operation, if you want to use form parameters of primitive data type of String, Integer, or Boolean in your operation. You cannot use this encoding to transmit files.
- Multipart (application/form-data) - Select this encoding for an operation, if you want to use form parameters of type String, Integer, Boolean, File/Binary, or File/Text in your operation. You can send or receive both text and binary files.
When you transmit a file using a form parameter, two elements get created in TIBCO Business Studio:
Creating Form Parameters
You can create form parameters in POST, PUT, and PATCH operations only. You can create or modify parameters for REST services that were created ground up in the TIBCO Business Studio without a Swagger file. For REST services that were created using a Swagger file that was imported into TIBCO Business Studio from an external source, such as the API Modeler, you can only view the parameters. You cannot create or modify the parameters in such services.
- Click Components under the Module Descriptors of your project 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 the post operation under Operations in the left tree.
- Click the Request tab.
Select an encoding for the operation from the
Request drop-down menu.
Select either Form Data - Tag/Value (application/x-www-form-urlencoded) or Form Data - Multipart (application/form-data). The Form Parameters table is displayed.
- Click the blue icon () on the right of the Form Parameters table to create a new form parameter.
- Click the name and edit it. To change the type, click the type in the Type column and select a type from the drop-down list. Similarly you can specify if this parameter is required or not by clicking in the Required column.