Library › Coding AI › Product managers
Write a curl call from an API doc for staging
Practice: Keeping the AI to your sources. About 5 minutes.
About this exercise
Write one curl command that lists open issues created on or after 2026-10-01, 50 per page, from the staging server at https://api.staging.trellis.example (not production). Read the token from the environment variable TRELLIS_TOKEN rather than pasting a token. Use the parameter names exactly as the doc writes them. One code block with just the command, no jq or scripts, then under 25 words outside the code.
Common mistakes when you ask AI for this
- Not naming the server. The AI copies the production URL from the doc. Try: Add: "Use the staging host https://api.staging.trellis.example."
- Not sticking to the doc. The AI guesses parameter names like status or limit from other APIs. Try: Add: "Use the parameter names exactly as the doc writes them."
- Pasting secrets. The AI copies the example token or invents one. Try: Add: "Read the token from $TRELLIS_TOKEN."
- Getting a menu of options. The AI likes to offer two or three versions of the command, so you're left to pick and test them yourself. Try: Add: "Give one command only, in one code block, no alternatives."
- Getting a tutorial. By default the AI explains every part of the code at length, which you then have to scroll past. Try: Add: "After the code, one line under 10 words. Nothing else."
What a strong prompt includes
- Names the staging host
- Sticks to the doc's names
- Uses an environment variable
- Gives the filters
- Asks for one answer only
Related exercises
- Accept a job offer and confirm the exact terms (Writing AI · Job seekers)
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)