Skip to content

Examples

Basic

By default yurl loads in a file named http.yaml.

http.yaml
1
2
3
4
5
6
7
8
9
config:
  host: jsonplaceholder.typicode.com
  port: 443
  scheme: https

requests:
  GetTodo:
    path: /todos/{{ id }}
    method: GET
bash
yurl GetTodo

Basic Example

Verbose output

bash
yurl -v GetTodo

Basic Example

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 }}"
      }
bash
yurl CreateTodo

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