Skip to content
v1.0.0

Content Types API

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
JSON
{
"name": "John Doe",
"age": 30,
"email": "john@example.com"
}

Responses

Successful response
application/json
JSON
{
"id": 123,
"name": "John Doe",
"status": "success",
"timestamp": "2023-06-07T14:30:00Z"
}

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
XML

Responses

Successful response
application/xml
XML

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

Responses

Successful response
application/json
JSON
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 3600
}

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

Responses

File uploaded successfully
application/json
JSON
{
"file_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"file_name": "profile.jpg",
"file_size": 1024000,
"file_url": "https://example.com/files/f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

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
JSON
"This is a plain text message sent to the server."

Responses

Successful response
text/plain
JSON
"Server received your message: This is a plain text message sent to the server."

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Upload Image

POST
/image

Example of a request with image content type.

Request Body

Responses

Image uploaded successfully
application/json
JSON
{
"image_id": "img_12345",
"url": "https://example.com/images/img_12345",
"width": 800,
"height": 600
}

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Powered by VitePress OpenAPI