Skip to main content

Basics of Dothttp Requests

Supported HTTP Methods#

Dothttp supports a wide range of HTTP methods, enabling you to interact with web services effectively. The supported methods include:

  • GET
  • POST
  • PUT
  • HEAD
  • COPY
  • LINK
  • LOCK
  • VIEW

The syntax for specifying an HTTP request is as follows: <METHOD> <URL>. For example, GET represents a GET request to

Example: PUT Request#


Try it in your browser

In curl terms, this is equivalent to:

curl -X PUT

Example DELETE request#


Try it in your browser

In curl terms, this is equivalent to:

curl -X DELETE

URL Parameters#

URL parameters are used to exchange small but meaningful pieces of information between web pages. For example, consider the URL, where page=3&query=ram are the URL parameters.

Dothttp provides a flexible way to define URL parameters using the following syntax:
? page = 3
? query = ram

With this syntax, you can easily comment out specific parameters, making it developer-friendly.

Example 1#

? key1 = value2
? key2 = value2
? key3 = "value2 with spaces"
? key4 = 'value2 with single quotes'

try in browser here

In curl terms, the request is:

curl -X GET ''

Example 2 (Dealing with Spaces and Special Characters)#

? age= 40
? name = "john don"

Try it in your browser

In curl terms, the request is:

curl -X GET ''

HTTP Headers#

HTTP headers convey essential information about a request or response, as well as the data transmitted in the message body. The syntax for specifying headers is as follows: key: value.


content-type: application/json

In this example, the request sets the content-type header to application/json.

Request Payload#

The request payload is the final part of a request and typically contains data that cannot be passed in the URL. While not all requests have payloads, POST and PUT methods commonly do.

Dothttp supports various payload formats, including text, JSON, URL-encoded, and multipart.

Text Payload#

Text payloads are specified with the syntax: data("this is payload"). Text payloads can span multiple lines without the need for escapes. Single and double quotes are also supported. To include double quotes within a payload, triple quotes can be used.

Example 1: Text Payload#

? key1 = value2
? key2 = value2
"this is text"
// Comment in between
" payload"

Try it in your browser

In curl terms, the request is:

curl -X POST -d 'this is text payload' ''

Example 2: Text Payload with Quotes#

To handle payloads containing quotes, Dothttp offers the flexibility of triple-quoted strings, inspired by Python.

? key1 = value2
? key2 = value2
"""this "is" text"""
// Comment in between
""" pay "ram" load"""
; // Break
'text/plain' // Content-Type

Try it in your browser

JSON Payload#

JSON (JavaScript Object Notation) payloads are widely used for data transfer in requests. The syntax for specifying JSON payloads is: json({"key": "value"}). Using a JSON payload sets the content-type to application/json by default, which can be overridden if necessary.

Example 3: JSON Payload#

"name": "john don",
// some comment
"age" : 20

Try it in your browser

URL-Encoded Payload#

URL-encoded payloads are commonly used in web requests when the content-type is not specified. The syntax for URL-encoded payloads is the same as for JSON payloads. Using URL-encoded payloads sets the content-type to application/x-www-form-urlencoded by default, which can also be overridden.

Example 4: URL-Encoded Payload#

"name": "john",
"age" : 20,
"lastname": 'doe',
// Single quotes

Try it in your browser

In curl terms, the request is equivalent to:

curl -X POST \
-H 'Content-Length: 31' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'name=john&age=20.0&lastname=doe' \

Multipart Payload#

Multipart payloads are used when multiple files need to be uploaded in a single request. The syntax for specifying multipart payloads is as follows:

"name of file" < "file path",
"name of file2" < "filepath2",
"name" < "inline value",

All file paths are verified, and if a file path is present, the file is sent in the request. Otherwise, the inline value is sent. Depending on the file extension, the content-type can be automatically set, although this can be overridden.

Example 1: Multipart Payload with a File#

'name' < 'value',
'name2' < '',
'name3' < '{"jsondata" : "jsonvalue"}' ; 'application/json'

Try it in your browser

In curl terms, the request is equivalent to:

curl -X POST \
--form name=value \
--form '' \
--form 'name3={"jsondata" : "jsonvalue"}' \

Binary Payload#

Dothttp files support only Unicode format, which means that embedding binary data in a Dothttp file is not supported. To upload binary data, you can use the fileinput("file path") syntax.

Example 1: Binary Payload#

// or
// < 'C:\Users\john\documents\movie.mkv'

cURL Equivalent#

Dothttp provides a simple way to generate cURL commands for your requests. Here's an example of a basic cURL request generated from a Dothttp request:

Example 1: Basic cURL Request#

curl -X POST
--header "content-type: text/plain"

Try it in your browser

For more examples, consider exploring the Dothttp Playground.