(setq org-babel-confirm-evaluate nil)
DEBIAN_FRONTEND=noninteractive apt-get --yes --quiet install jq
:results: Reading package lists... Building dependency tree... Reading state information... jq is already the newest version (1.6-2.1ubuntu3). The following packages were automatically installed and are no longer required: libflashrom1 libftdi1-2 libllvm13 wireguard-tools Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded. :end:
curl -s "${URL}?page=${PAGE}" -H "Content-Type: application/json" \ | jq
{ "page": 1, "per_page": 6, "total": 12, "total_pages": 2, "data": [ { "id": 1, "email": "george.bluth@reqres.in", "first_name": "George", "last_name": "Bluth", "avatar": "https://reqres.in/img/faces/1-image.jpg" }, { "id": 2, "email": "janet.weaver@reqres.in", "first_name": "Janet", "last_name": "Weaver", "avatar": "https://reqres.in/img/faces/2-image.jpg" }, { "id": 3, "email": "emma.wong@reqres.in", "first_name": "Emma", "last_name": "Wong", "avatar": "https://reqres.in/img/faces/3-image.jpg" }, { "id": 4, "email": "eve.holt@reqres.in", "first_name": "Eve", "last_name": "Holt", "avatar": "https://reqres.in/img/faces/4-image.jpg" }, { "id": 5, "email": "charles.morris@reqres.in", "first_name": "Charles", "last_name": "Morris", "avatar": "https://reqres.in/img/faces/5-image.jpg" }, { "id": 6, "email": "tracey.ramos@reqres.in", "first_name": "Tracey", "last_name": "Ramos", "avatar": "https://reqres.in/img/faces/6-image.jpg" } ], "support": { "url": "https://reqres.in/#support-heading", "text": "To keep ReqRes free, contributions towards server costs are appreciated!" } }
read -r -d '' DATA <
curl \ --request POST \ --silent "${URL}" \ --header "Content-Type: application/json" \ --data "${DATA}" \ | jq
{ "name": "morpheus", "job": "bar", "id": "243", "createdAt": "2023-03-03T00:46:58.926Z" }
read -r -d '' CREDENTIALS <
curl \ --request POST \ --silent "${URL}" \ --header "Content-Type: application/json" \ --data "${CREDENTIALS}" \ | jq -r ".token"
:results: QpwL5tke4Pnpja7X4 :end:
This does not work, because the API does not respond with a good answer, when we set the authorization header.
curl \ --request GET \ --silent "${URL}?page=${PAGE}" \ --header "Content-Type: application/json" \ --header "Authorization: Basic ${TOKEN}" \ | jq
:results: :end: