Examples
Basic
By default yurl
loads in a file named http.yaml
.
http.yaml |
---|
| config:
host: jsonplaceholder.typicode.com
port: 443
scheme: https
requests:
GetTodo:
path: /todos/{{ id }}
method: GET
|
Verbose output
Post request with json body
http.yaml |
---|
| config:
host: jsonplaceholder.typicode.com
port: 443
scheme: https
requests:
CreateTodo:
path: /todos
method: POST
jsonBody: |
{
"title": "{{ title }}"
}
|
Specify a request file
Use the -f
or --file
to specify a requests file.
requests.yaml |
---|
| config:
host: jsonplaceholder.typicode.com
port: 443
scheme: https
requests:
CreateTodo:
path: /todos
method: POST
jsonBody: |
{
"title": "{{ title }}"
}
|
bash |
---|
| yurl -f requests.yaml CreateTodo
|
Passing variables
Use the -var
or --variable
to specify a variable.
requests.yaml |
---|
| config:
host: jsonplaceholder.typicode.com
port: 443
scheme: https
requests:
CreateTodo:
path: /todos
method: POST
jsonBody: |
{
"title": "{{ title }}",
"userId": {{ userId }}
}
|
bash |
---|
| yurl -f requests.yaml -var title=Title CreateTodo
|
Provide as many variables as you want.
bash |
---|
| yurl -f requests.yaml -var title=Title -var userId=1 CreateTodo
|