Query & Body Directives
Query & Body Directives
Section titled “Query & Body Directives”@query — Query Parameters
Section titled “@query — Query Parameters”Define query parameters as separate directives instead of embedding them in the URL:
@name Search UsersGET {{baseUrl}}/users@query page = 1@query limit = 20@query search = {{searchTerm}}@query filter = "active users"This is equivalent to:
GET {{baseUrl}}/users?page=1&limit=20&search={{searchTerm}}&filter=active%20usersFeatures
Section titled “Features”- Auto-encoding: Values are automatically encoded with
encodeURIComponent - Variable support: Use
{{}}variables in values - Quote removal: Wrapping quotes are automatically stripped
@body — Body from File
Section titled “@body — Body from File”Load the request body from an external file:
@name Upload DataPOST {{baseUrl}}/importContent-Type: application/json@body ./data/payload.jsonUse Cases
Section titled “Use Cases”- Large payloads: Keep big JSON payloads in separate files
- Shared bodies: Reuse the same body across multiple requests
- Binary data: Reference binary files for upload endpoints
Example
Section titled “Example”@name Import ConfigurationPOST {{baseUrl}}/config/importContent-Type: application/json@body ./fixtures/config.json
@assert status == 200@assert body.imported == trueNext Steps
Section titled “Next Steps”- Learn about shared configuration
- Explore assertions for response validation