Search Results

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. Move the mouse pointer over the Request Content Type section and click to change the content type. Click Save.

    • application/x-www-form-urlencoded: 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:

    • In the Name field, enter a parameter name.
    • 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.

    • 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.

    • In the Description field, enter a description for the added parameter.
    • In the Default value field, enter a default value.
    • Select the Required check box if the parameter is required. The required parameter is displayed in bold.
    • 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.