Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use a simple bash script:

    #!/bin/bash -x

    TOK="my-jwt-tok"

    case "$1" in
        get-foo)
            curl -H "header: bearer $TOK" "http://www.example.com/foo" | jq .
            ;;

        post-bar)
            curl \
              -H "header: bearer $TOK" "http://www.example.com/bar" \
              -H "content-type: application/json" \
              --data-raw '{"baz":"bap"}'

            ;;  
        *)
            ;;  

    esac
used like:

    ./example.bash get-foo

I know it doesn't have the functionality of postman, but this is how I build up interactions with a new API.


I would like to put the request body into a file and use it with `@file.json`.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: