xh is a simple http client for the terminal available in your package manager.
Verbs
# request to http://localhost:300/users
xh get :3000/users
# get
xh get httpbin.org/json
xh httpbin.org/json
# post with body: { "string": "test", "num": 42, "bool": true }
xh post httpbin.org/post string=test num:=42 bool:=true
xh httpbin.org/post key=val
# any other verb
xh delete httpbin.org/delete
Sessions
export api=":3000"
xh get $api/whoami
xh --session root post $api/login email=AzureDiamond@example.com pass=hunter2
xh --session root get $api/whoami
Note that you can create multiple sessions at once.
Filtering
# pipes & json filtering
xh get httpbin.org/json --body | jq -r .slideshow.slides[0].title