Send Http Request
The http command in Srotas allows users to send a single HTTP request without requiring a configuration file. It is intended for quick, ad-hoc requests rather than extensive usage. This command is useful when testing an API endpoint or making a one-time request after running a configuration.
Usage
srotas http [METHOD] [URL] [flags]METHOD: The HTTP method to use (e.g., GET, POST, PUT, DELETE).URL: The endpoint to send the request to.
For a complete list of available flags and usage details, run:
srotas http --helpExample
srotas http GET https://api.example.com/usersFlags and Options
Query Parameters
Usage
srotas http GET https://api.example.com/users --query "key=value"srotas http GET https://api.example.com/users -Q "key=value"Format
key=value- Multiple query parameters can be specified using multiple
--queryflags or by separating them with a comma.
Example
srotas http GET https://api.example.com/users --query "status=active" --query "role=admin"Headers
Usage
srotas http GET https://api.example.com/users --headers "key:value"srotas http GET https://api.example.com/users -H "key:value"Format
key:value- Multiple headers can be specified using multiple
--headersflags.
Example
srotas http GET https://api.example.com/users --headers "Authorization: Bearer abc123" --headers "X-Correlation-ID: 12345"Request Body
Usage
srotas http POST https://api.example.com/users --body '{"name": "John Doe"}'srotas http POST https://api.example.com/users -B '{"name": "John Doe"}'Format
- A JSON-formatted string.
Example
srotas http POST https://api.example.com/users --body '{"name": "Alice", "email": "alice@example.com"}' --headers "Content-Type: application/json"Warning
The http command does not support expressions (expr). Only static values can be used.
Note
It is not designed for heavy usage or complex workflows. Best used for quick testing of API endpoints or making a one-off request after running a configuration.