Skip to content

Example of an OpenAPI document with different content types for requests and responses.

Contact

Servers

https://api.example.com

JSON Content Type

POST
/json

Example of a request and response with JSON content type.

Request Body

application/json
object
Format"email"

Responses

Successful response

application/json
object
Format"date-time"

Playground

Body

Samples

cURL
JavaScript
PHP
Python

XML Content Type

POST
/xml

Example of a request and response with XML content type.

Request Body

application/xml
object
object

Responses

Successful response

application/xml
object
object

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Form URL Encoded Content Type

POST
/form

Example of a request with form URL encoded content type.

Request Body

object
Format"password"

Responses

Successful response

application/json
object

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Multipart Form Data Content Type

POST
/multipart

Example of a request with multipart form data content type for file uploads.

Request Body

multipart/form-data
object

File to upload

Format"binary"
Valid values"avatar""document""other"

Responses

File uploaded successfully

application/json
object
Format"uri"

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Plain Text Content Type

POST
/text

Example of a request and response with plain text content type.

Request Body

text/plain

Responses

Successful response

text/plain

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Upload Image

POST
/image

Example of a request with image content type.

Request Body

A PNG image

Format"binary"

Responses

Image uploaded successfully

application/json
object
Format"uri"

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Powered by VitePress OpenAPI