>_ IzzyLab

Hands-on task

This task is step 13 of the course “JSON, YAML and XML in the terminal”

The release commit from an API response

medium~5 min

The billing service reports its status as JSON at http://localhost/status. You can see its page in the Site tab above the terminal. Find out which commit the current release was built from: write only the commit hash to /root/commit.txt — without quotes and the rest of the JSON.

What you'll practise:
  • curl
  • jq
  • nested fields
  • jq -r
  • pipeline

Topic breakdown

API responses are almost always nested: the value you need isn't at the top level but inside an object. They're taken apart with a pipeline: curl -s fetches the body without a progress bar, and jq walks the structure. The path to a nested field is written as a chain of dots, and the -r (raw output) flag prints a string without JSON quotes — so the value can go straight into a file or a variable. It's useful to look at the whole response with jq . first to see the structure, and only then write the exact path.

What's checked

  1. the commit hash is extracted

What it looks like