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.

An operation can have one of the following encodings. Both encodings have Tag/Value:
  • 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™:

    • name - used to store the name of the file
    • content - used to store the actual data within the file

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.

To create a form parameter, do the following:

Procedure

  1. Click Components under the Module Descriptors of your project to open the Component Configurations page.
  2. Expand the Component<application_name> node.
  3. Double-click the process name (with the green chevron next to it) to open its properties in the Properties view.
  4. Click the Bindings tab.
  5. Click the post operation under Operations in the left tree.
  6. Click the Request tab.
  7. 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.
  8. Click the blue icon () on the right of the Form Parameters table to create a new form parameter.
  9. 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.