---
title: "Keep your test requests: curl, jq and scripts"
summary: "Save your API checks as a repeatable script with curl and jq, so one command tells you if the API still works. Postman is optional."
url: "https://lab.blue-unlimited.com/en/learn/keep-your-test-requests"
language: en
updated: "2026-10-25"
---

[Home](https://lab.blue-unlimited.com/en) / [Learn](https://lab.blue-unlimited.com/en/learn) / Keep your test requests: curl, jq and scripts

**Guide · Web basics**

# Keep your test requests: curl, jq and scripts

Save your API checks as a repeatable script with curl and jq, so one command tells you if the API still works. Postman is optional.

- **Reading time**: 8 min
- **Tested on**: 2026-10-25

Save your API checks as a repeatable script with curl and jq, so one command tells you if the API still works. Postman is optional.

## In plain words

A test request is a question you ask over and over to check the program still answers right. Instead of typing it every time, you write the question and the right answer down once, and a script asks for you.

## Try it yourself

Write `tests.sh` next to `app.py`. It asks the API a question and fails when the answer is wrong:

```bash
#!/usr/bin/env bash
set -euo pipefail
base=${BASE:-http://localhost:8000}

got=$(curl -s "$base/upper?text=hello" | jq -r .upper)
if [ "$got" = "HELLO" ]; then echo "PASS upper"; else echo "FAIL upper: got $got"; exit 1; fi

code=$(curl -s -o /dev/null -w '%{http_code}' "$base/upper")
echo "status without text: $code"
```

Run it with the API running:

```bash
chmod +x tests.sh
./tests.sh
```

The `BASE` variable lets you point the same script at another address later.

## A step further

`set -euo pipefail` makes the script stop at the first error instead of carrying on. `curl -s` hides the progress bar, `-o /dev/null -w '%{http_code}'` prints only the status code, and `jq -r` gives a raw value without quotes.

**Postman** does the same with a window and saved collections. It is an application for your own computer, and it can export its collections as JSON. A script like this one is plain text, lives in Git and runs anywhere, so it is the one to commit.

## How it works in real projects

These checks run automatically before a change is accepted. A test framework such as pytest does the same job in Python.

## Tools in this guide

- [AI Workshops](https://lab.blue-unlimited.com/en/ai-workshops) (More time, Internal): AI agents and skills built around your processes and your voice, and your team trained to work with them safely.

## Not sure where to start? Tell us what's slowing you down. Let's chat.

[Let's chat](https://lab.blue-unlimited.com/en/contact?cta=chat&item=keep-your-test-requests)
