Adding and Editing Form Parameters

Form parameters are used to describe the payload of an HTTP request when either application/x-www-form-urlencoded or multipart/form-data is used as the content type of the request. This is the only parameter type that can be used to send files. Form parameters have a different format based on the used content type. For details, visit http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.

Note: Because Form parameters are sent in the payload, they cannot be declared together with a Body parameter for the same operation.

Adding Form Parameters

To add Form parameters, complete these steps:

  1. In the right Request Body Parameter section, click Switch to Form parameters. The Request Form Parameters section is displayed.

  2. By default, the application/x-www-form-urlencoded content type is selected. In the Request Content Type section, click an option to change the content type:

    • application/x-www-form-urlencoded: Is similar to the format of Query parameters, but as a payload. For example, foo=1&bar=swagger - both foo and bar are Form parameters. This is normally used for simple parameters that are being transferred.
    • multipart/form-data: Each parameter takes a section in the payload with an internal header. For example, for the header Content-Disposition: form-data; name="submit-name", the name of the parameter is submit-name. This type is more commonly used for file transfers.
  3. Click + Form parameter to add Form parameters:
    1. In the Name field, enter a parameter name.
    2. From the data type list, select a data type. By default, the data type is string.
      Note: The file/text and file/binary options are available only when the content type is multipart/form-data, which are used to send a file in the request content.
    3. Select the array check box if the parameter is array.
      Note: If the data type is file/text or file/binary, this function is disabled.
    4. In the Description field, enter a description for the added parameter.
    5. In the Default value field, enter a default value.
    6. Select the Required check box if the parameter is required. The required parameter is displayed in bold.
    7. Click Save.

Editing Form Parameters

To edit an added Form parameter, complete these steps:

  1. In the right Request Form Parameters section, move the mouse pointer over the Form parameter.
  2. Click Edit to edit the Form parameter or click to delete the Form parameter.