Request Payloads (Body)

RestApia allows you to send various types of data as the request body, catering to different API requirements. This is an optional part of your request.

Sending a File as Binary Data

You can directly send the contents of a file as the request body.

File Body Example
// endpoint
POST https://httpbin.org/post

filesPath: X:\Temp

#file text/plain
{{filesPath}}\hello.txt

URL-Encoded Form Data

Send data as a URL-encoded form, commonly used for submitting form data.

URL-Encoded Form Example
value: value 2

// endpoint
POST https://httpbin.org/post

#form
a: value 1
b: {{value}}
c: value 3

JSON Payload

Send data as a JSON object.

JSON Payload Example
string1: value 1
number2: 42

// endpoint
POST https://httpbin.org/post

// #json keyword is optional
#json
{
    "string": "{{string1}}",
    "number": {{number2}}
}

Multipart Form Data

Send data as a multipart form, useful for uploading files and other form data.

Multipart Form Example
// endpoint
POST https://httpbin.org/post

// variables
filesPath: X:\Temp
var1: value 1

// multipart form values
#multipart
var1: {{var1}}
var2: value 2
MyFile: [file:{{filesPath}}\hello.txt]

Raw Body

Send data as a raw body with a specific content type.

Raw Body Example
// variables
color: #9461ff

// endpoint
POST https://httpbin.org/post

// raw body with content type
#raw text/css
body {
  color: {{color}}
}

XML Body

Send data as an XML document.

XML Body Example
// variables
name: John

// endpoint
POST https://httpbin.org/post

// request body example
#xml
<name>
    <first>{{name}}</first>
    <last>Doe</last>
</name>