Horses and people › A horse's career record
A horse's career record
Find a horse, then read its career record: runs, wins, places and the span of them. Its breeding comes in the same reply where it has been fetched.
# A horse's career record
# needs: AHR_KEY in your environment, and jq to read the reply
ID=$(curl -s "https://api.apihorseracing.com/v1/horses/search?name=Constitution%20Hill" \
-H "X-API-Key: $AHR_KEY" | jq -r '.data[0].horse_id')
curl -s "https://api.apihorseracing.com/v1/horses/$ID" \
-H "X-API-Key: $AHR_KEY" \
| jq -r '.data | "Horse: \(.name)", "Runs: \(.career.runs)", "Wins: \(.career.wins)", "Seconds: \(.career.seconds)", "First run: \(.career.first_run)"'
What the reply holds
- career
- Runs, wins, places and the span of them.
- pedigree
- Sire, dam and damsire, each with its own id.
When it says no
401no_key The key is missing or mistyped. Every sample reads it from AHR_KEY.403plan_needed Your plan does not reach this. The reply names the plan that does.429rate_limited Too fast. Wait the seconds in Retry-After, then try again.