The PawFinder Service API uses a token-based authentication system.
Read-only operations, GET requests, don’t require authentication.
Operations that change data, such as POST, PUT, PATCH, and
DELETE require an API token passed in the request header.
| HTTP Method | Purpose | Authentication Required |
|---|---|---|
GET |
Retrieve pet or shelter profiles | No |
POST |
Add a new pet or shelter profile | Yes |
PUT |
Replace an entire pet or shelter profile | Yes |
PATCH |
Partially update a pet or shelter profile | Yes |
DELETE |
Remove pet or shelter profiles from the PawFinder System | Yes |
For any write operation, include the API token in the Authorization header:
Authorization: Bearer API_TOKEN
curl -X POST {base_url}/shelters \
-H "Authorization: Bearer token_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Dallas Animal Rescue",
"city": "Dallas",
"state": "TX"
}'
curl {base_url}/pets
For development and testing purposes, assign any string as the token. In a production environment, PawFinder issues tokens through a proper authentication system.
For local development:
json-server -w pawfinder-db-source.json.test-token, dev-key, etc.Authorization: Bearer header to perform write operations..env file and add it to the .gitignore file.# Store the token in an .env file and don't commit it to git
API_TOKEN=secret_token
# Use the token in the request
curl -X POST {base_url}/pets \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Buddy", "species": "dog"}'
A write operation attempt without an authentication header returns
a 401 Unauthorized response:
{
"error": "Unauthorized",
"message": "Authentication token is required for this operation."
}
An invalid or malformed token returns a 403 Forbidden response:
{
"error": "Forbidden",
"message": "Invalid or expired authentication token."
}
Reaching the rate limit returns the 429 Too Many Requests response:
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Try again in 60 seconds.",
"status": 429,
"retry_after": 60
}
For development and testing, there are currently no strict rate limits, as json-server isn’t designed for high-volume traffic. In production, use rate limiting to:
A typical approach would limit requests per IP or API key over a time window. In a production environment, responses might include rate limit headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1638360000
An example breakdown of client request limits:
| Tier | Requests per minute | Daily limit |
|---|---|---|
| Free | 60 | 1,000 |
| Standard | 300 | 10,000 |
| Premium | 1,000 | 100,000 |
| Enterprise | Custom | Custom |
The PawFinder Service API is a project for shared documentation practice and educational purposes only. PawFinder uses json-server and an intentionally minimal authentication system. In a production system, consider the following: