Learn
Point SnapAPI at your API
Swap the mock for the origin you already curl. Same file, real URL:.
Start from a curl that works
If this works:
curl -sS https://api.myapp.com/users \
-H "Authorization: Bearer $TOKEN"
convert it:
snapapi convert 'curl -sS https://api.myapp.com/users -H "Authorization: Bearer $TOKEN"' -o my.sapi
that’s this suite:
SUITE: Converted Request
URL: https://api.myapp.com
TEST: Get Users
GET: /users
AUTH: bearer ${TOKEN}
snapapi my.sapi -D TOKEN="$TOKEN"
Then add EXPECT, SAVE, and helpers. Curl is the on-ramp; SnapAPI is the maintainable test. It will not import a full Karate/Postman suite — only the requests you already curl.
The rest maps the obvious way:
| curl | SnapAPI |
|---|---|
https://host in the URL | URL: https://host (no path) |
-X POST and the path | POST: /that/path |
-H "Authorization: Bearer …" | AUTH: bearer ${TOKEN} |
-H "Content-Type: application/json" | HEADER Content-Type: application/json |
-d '{"name":"Jane"}' | BODY: {"name": "Jane"} |
| status you already know is success | EXPECT: status == 201 |
https://api.example.com in the DSL reference is a placeholder. It isn’t a live demo. Use the host you actually curl.When it fails
- Connection errors are DNS, TLS, or nothing listening — same as curl.
- Wrong path or method is usually
404/405from that server. - Missing
${TOKEN}is SnapAPI’sUndefined variable. A bad token is the API’s401. - Playground Live fetch uses the browser. Lots of APIs have no CORS, so curl/CLI work and the tab doesn’t.
Green on your laptop → same command in CI. Common misses: Troubleshooting.