Parameters and request bodies allow you to send data with your API requests. This guide covers query parameters, path variables, and different request body formats.
Path Variables
Path variables allow you to define dynamic segments in your API URL using the :variableName syntax. This is useful for RESTful APIs where resource identifiers are part of the URL path.
For example, if your API endpoint is:
https://api.example.com/users/:userId/posts/:postId
Requestly automatically detects the path variables (:userId and :postId) from the URL and displays them in the Params tab under Path Variables. You can then set values for each variable:
| Key | Value | Description |
|---|
| userId | 123 | The user’s unique identifier |
| postId | 456 | The post’s unique identifier |
When you send the request, Requestly compiles the URL with your provided values:
https://api.example.com/users/123/posts/456
Path variables are automatically extracted from your URL. Simply type a URL with :variableName segments, and they’ll appear in the Path Variables table for you to fill in.
Query Parameters
In the Query Params section, you can add query parameters as key-value pairs to send extra information with the URL. To add more parameters, click on the + Add More button.
Each query parameter consists of:
- Key: The parameter name
- Value: The parameter value
- Type: An enum to enforce the value type
- Description (optional): Internal documentation explaining the purpose of the parameter
For example:
- Adding
uid=123 to https://app.requestly.io/echo results in: https://app.requestly.io/echo?uid=123
The checkboxes next to each parameter let you include or exclude them without deleting them. For instance, if you uncheck a parameter, the final URL will not include it.
Bulk Edit Query Parameters
You can also manage query parameters using Bulk Edit. This allows you to add or update multiple parameters at once in a key:value format.
- Add one parameter per line
- Separate keys and values using a colon
:
- Prefix any line with
// to disable that parameter
Bulk Edit is useful when working with a large number of query parameters or when making quick mass updates.
Example:
page:1
limit:50
sort:desc
// filter:active
Request Body
For POST, PUT, or PATCH requests, use the Body tab to send data to the server. Requestly supports multiple body formats to accommodate different API requirements.
Supported Body Types
RAW (JSON/Text)
x-www-form-urlencoded
multipart/form-data
GraphQL
Requestly will automatically add certain headers to your requests based on your request body selections. When you add a request body, Requestly automatically sets the appropriate Content-Type header:
| Body Type | Content-Type Header |
|---|
| RAW (JSON) | application/json |
| RAW (Text) | text/plain |
| RAW (XML) | application/xml |
| x-www-form-urlencoded | application/x-www-form-urlencoded |
| multipart/form-data | multipart/form-data |
You can view and override the autogenerated headers in the Headers tab. These headers are automatically managed by Requestly to ensure your requests are properly formatted.
What’s Next?