Tests REST APIs with curl, httpie, and Newman, covering auth, contracts, and response validation from the terminal.
Agentic Workflow: Read -> Reason -> Act (api-testing)
You are api-testing (testing/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — testing context for api-testing
- Domain: Tests REST APIs with curl, httpie, and Newman, covering auth, contracts, and response validation from the terminal.
- curl-testing: Craft and assert on API requests with curl. —
curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/v1/users
- httpie-testing: Human-friendly API testing with httpie. —
http GET http://localhost:8080/v1/users
- newman-collections: Run Postman collections with assertions in CI. —
newman run api.postman_collection.json
- Check
knowledge and prerequisites: http, newman
2. Reason — think for api-testing
- For
curl-testing: Craft and assert on API requests with curl. — decide which checks to run
- For
httpie-testing: Human-friendly API testing with httpie. — decide which checks to run
- For
newman-collections: Run Postman collections with assertions in CI. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-testing tools
- Tools:
Glob, Grep, Read, Bash, Http (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-testing:348794e5
API Testing
Test REST APIs quickly from the terminal with curl, httpie, and Newman.
What This Skill Does
- Exercises endpoints with status and body assertions
- Verifies auth, headers, and contract fields
- Runs Postman collections in CI with data files
- Generates HTML/CLI reports
When to Use
- Quick smoke tests of a new endpoint
- Contract verification before merge
- CI regression suites for APIs
Real Commands
# curl
curl -s -o /dev/null -w '%{http_code}' https://api.example.com/v1/users
curl -s -X POST https://api.example.com/v1/users -H 'Content-Type: application/json' -d '{"name":"alice"}'
curl -s https://api.example.com/v1/users | jq -e '.data | length > 0'
# httpie
http GET https://api.example.com/v1/users
http POST https://api.example.com/v1/users name=alice role=admin
http -h GET https://api.example.com/v1/users
# Newman
newman run collection.json -e staging.postman_environment.json
newman run collection.json -d data.csv -r html,cli --reporter-html-export report.html
Assertion Pattern (Newman script)
pm.test("returns 201 and user id", () => {
pm.response.to.have.status(201);
const body = pm.response.json();
pm.expect(body.data.id).to.be.a('string');
});
Best Practices
- Assert status AND schema, not just 200
- Keep tests independent; create resources in setup scripts
- Use environment variables for base URLs and tokens
- Run collections with data files for data-driven cases
- Fail CI on HTTP 5xx or schema drift
Capabilities
curl-testing
Craft and assert on API requests with curl.
Parameters:
method (string): HTTP method: GET, POST, PUT, DELETE
headers (object): Request headers
data (object): JSON request body
Commands:
curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/v1/users
curl -s -X POST http://localhost:8080/v1/users -H 'Content-Type: application/json' -d '{"name":"alice"}'
curl -s http://localhost:8080/v1/users | jq -e '.data | length > 0'
curl -sI http://localhost:8080/v1/health
curl -s -u user:pass http://localhost:8080/v1/users
Examples:
httpie-testing
Human-friendly API testing with httpie.
Parameters:
url (string): Request URL
fields (object): Form or JSON fields
Commands:
http GET http://localhost:8080/v1/users
http POST http://localhost:8080/v1/users name=alice role=admin
http --json POST http://localhost:8080/v1/users <<< '{"name":"bob"}'
http -h GET http://localhost:8080/v1/users
http GET http://localhost:8080/v1/users Authorization:'Bearer $TOKEN'
Examples:
newman-collections
Run Postman collections with assertions in CI.
Parameters:
collection (string): Collection JSON path
environment (string): Environment JSON path
dataFile (string): CSV/JSON data file for iteration
Commands:
newman run api.postman_collection.json
newman run collection.json -e staging.postman_environment.json
newman run collection.json -d data.csv
newman run collection.json -r html,cli --reporter-html-export report.html
newman run collection.json --env-var baseUrl=http://localhost:8080
Examples:
- newman run collection.json -e staging.env.json
- newman run collection.json -r html,cli --reporter-html-export report.html
- newman run collection.json --env-var baseUrl=http://localhost:8080
References
1---2name: "api-testing"3description: "Tests REST APIs with curl, httpie, and Newman, covering auth, contracts, and response validation from the terminal. Use when working with curl testing, httpie testing, newman collections or when the user mentions curl testing, httpie testing, newman collections."4license: "MIT"5compatibility: "Requires http, newman. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-testing8 author: Kdesk9 version: 2.0.010 category: testing11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(http:*) Bash(newman:*)"12---1314Tests REST APIs with curl, httpie, and Newman, covering auth, contracts, and response validation from the terminal.1516## Agentic Workflow: Read -> Reason -> Act (api-testing)1718You are **api-testing** (testing/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — testing context for `api-testing`21- Domain: Tests REST APIs with curl, httpie, and Newman, covering auth, contracts, and response validation from the terminal.22- **curl-testing**: Craft and assert on API requests with curl. — `curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/v1/users`23- **httpie-testing**: Human-friendly API testing with httpie. — `http GET http://localhost:8080/v1/users`24- **newman-collections**: Run Postman collections with assertions in CI. — `newman run api.postman_collection.json`25- Check `knowledge` and `prerequisites: http, newman`2627### 2. Reason — think for `api-testing`28- For `curl-testing`: Craft and assert on API requests with curl. — decide which checks to run29- For `httpie-testing`: Human-friendly API testing with httpie. — decide which checks to run30- For `newman-collections`: Run Postman collections with assertions in CI. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `api-testing` tools34- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Http` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `api-testing:348794e5`3738# API Testing3940Test REST APIs quickly from the terminal with curl, httpie, and Newman.4142## What This Skill Does4344- Exercises endpoints with status and body assertions45- Verifies auth, headers, and contract fields46- Runs Postman collections in CI with data files47- Generates HTML/CLI reports4849## When to Use5051- Quick smoke tests of a new endpoint52- Contract verification before merge53- CI regression suites for APIs5455## Real Commands5657```bash58# curl59curl -s -o /dev/null -w '%{http_code}' https://api.example.com/v1/users60curl -s -X POST https://api.example.com/v1/users -H 'Content-Type: application/json' -d '{"name":"alice"}'61curl -s https://api.example.com/v1/users | jq -e '.data | length > 0'6263# httpie64http GET https://api.example.com/v1/users65http POST https://api.example.com/v1/users name=alice role=admin66http -h GET https://api.example.com/v1/users6768# Newman69newman run collection.json -e staging.postman_environment.json70newman run collection.json -d data.csv -r html,cli --reporter-html-export report.html71```7273## Assertion Pattern (Newman script)7475```js76pm.test("returns 201 and user id", () => {77 pm.response.to.have.status(201);78 const body = pm.response.json();79 pm.expect(body.data.id).to.be.a('string');80});81```8283## Best Practices8485- Assert status AND schema, not just 20086- Keep tests independent; create resources in setup scripts87- Use environment variables for base URLs and tokens88- Run collections with data files for data-driven cases89- Fail CI on HTTP 5xx or schema drift9091## Capabilities9293### curl-testing94Craft and assert on API requests with curl.9596**Parameters:**97- `method` (string): HTTP method: GET, POST, PUT, DELETE98- `headers` (object): Request headers99- `data` (object): JSON request body100101**Commands:**102- `curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/v1/users`103- `curl -s -X POST http://localhost:8080/v1/users -H 'Content-Type: application/json' -d '{"name":"alice"}'`104- `curl -s http://localhost:8080/v1/users | jq -e '.data | length > 0'`105- `curl -sI http://localhost:8080/v1/health`106- `curl -s -u user:pass http://localhost:8080/v1/users`107108**Examples:**109- curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/v1/users110- curl -s -X POST http://localhost:8080/v1/users -H 'Content-Type: application/json' -d '{"name":"alice"}' | jq .111- curl -s http://localhost:8080/v1/users | jq -e '.data | length > 0'112113### httpie-testing114Human-friendly API testing with httpie.115116**Parameters:**117- `url` (string): Request URL118- `fields` (object): Form or JSON fields119120**Commands:**121- `http GET http://localhost:8080/v1/users`122- `http POST http://localhost:8080/v1/users name=alice role=admin`123- `http --json POST http://localhost:8080/v1/users <<< '{"name":"bob"}'`124- `http -h GET http://localhost:8080/v1/users`125- `http GET http://localhost:8080/v1/users Authorization:'Bearer $TOKEN'`126127**Examples:**128- http GET http://localhost:8080/v1/users129- http POST http://localhost:8080/v1/users name=alice role=admin130- http -h GET http://localhost:8080/v1/users131132### newman-collections133Run Postman collections with assertions in CI.134135**Parameters:**136- `collection` (string): Collection JSON path137- `environment` (string): Environment JSON path138- `dataFile` (string): CSV/JSON data file for iteration139140**Commands:**141- `newman run api.postman_collection.json`142- `newman run collection.json -e staging.postman_environment.json`143- `newman run collection.json -d data.csv`144- `newman run collection.json -r html,cli --reporter-html-export report.html`145- `newman run collection.json --env-var baseUrl=http://localhost:8080`146147**Examples:**148- newman run collection.json -e staging.env.json149- newman run collection.json -r html,cli --reporter-html-export report.html150- newman run collection.json --env-var baseUrl=http://localhost:8080151152## References153- [curl Documentation](https://curl.se/docs/)154- [httpie Documentation](https://httpie.io/docs/cli)155- [Newman Documentation](https://learning.postman.com/docs/running-collections/using-newman-cli/)