Basic usage
Create a new request
Requests can be created using Sendex via the new
command. This command will create a file at the specified file path using a standard template which you can use as a starting point.
sendex new requests/get-todo.yml
This command will create a file at requests/get-todo.yml
using the default GET template.
Editing your request
Opening the file will give us this:
args: - id: 1 # specify 1 as defaultmethod: GETendpoint: http://localhost:8000/blog/{id} # we can use 'id' hereheaders: - Content-Type: application/json - Accept: application/jsonallow-headers: - Content-Type
Click here for full explanation of all parameters that can be used.
- The
args
parameter allows us to pass in command line arguments. Formatted likeid=2
method
can be any HTTP methodendpoint
is the API URLheaders
must be used in list formatallow-headers
keeps the output clean, but only showing the headers listed
If you’re just trying out Sendex, feel free to use a test API, such as JSON Placeholder. Replace the default endpoint with https://jsonplaceholder.typicode.com/todos/{id}
.
Running a request
Once your request file has been updated for your API, it can then be ran using:
sendex run request/get-todo.yml id=123
This should give the following response:
200 OKContent-Type: application/json; charset=utf-8{ "userId": 7, "id": 123, "title": "esse et quis iste est earum aut impedit", "completed": false}