You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This re-organizes and streamlines the form-urlencoded guidance
that was consolidated from the Media Type Object.
It also adds an example of a base64-encoded URL query parameter.
Copy file name to clipboardExpand all lines: versions/3.0.4.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1648,13 +1648,15 @@ This makes the presence of at least one of `style`, `explode`, or `allowReserved
1648
1648
1649
1649
##### Encoding the `x-www-form-urlencoded` Media Type
1650
1650
1651
-
See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
1651
+
To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), use the `application/x-www-form-urlencoded` media type in the [Media Type Object](#mediaTypeObject) under the [Request Body Object](#requestBodyObject).
1652
+
This configuration means that the request body MUST be encoded per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server, after any complex objects have been serialized to a string representation.
1652
1653
1653
-
To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following
1654
-
definition may be used:
1654
+
See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
1655
1655
1656
1656
###### Example: URL Encoded Form with JSON Values
1657
1657
1658
+
When there is no [`encoding` field](#mediaTypeEncoding), the serialization strategy is based on the Encoding Object's default values:
1659
+
1658
1660
```yaml
1659
1661
requestBody:
1660
1662
content:
@@ -1671,11 +1673,7 @@ requestBody:
1671
1673
properties: {}
1672
1674
```
1673
1675
1674
-
In this example, the contents in the `requestBody` MUST be encoded per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server. In addition, the `address` field complex object will be serialized to a string representation prior to encoding.
1675
-
1676
-
When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [Encoding Object](#encodingObject)'s [`style`](#encodingStyle) property as `form`.
1677
-
1678
-
With this example, given an `id` of `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` and a US-style address (with ZIP+4) as follows:
1676
+
With this example, consider an `id` of `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` and a US-style address (with ZIP+4) as follows:
It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads.
0 commit comments