This document details all HTTP endpoints available in the Card Reader Web Server.
All endpoints require HTTP Basic Authentication using the credentials defined in secret.h:
- Username:
www_username - Password:
www_password - Realm: "MyApp"
Note: Replace username:password in the CURL examples below with your actual credentials.
- PUT
/card- Description: Add a new card to the database
- Parameters:
number(required): Card number (integer)
- Response:
200: Card number on success400: "Missing card number parameter" or "Invalid card number"500: "Failed to add card"
- Authentication: Required
- CURL Example:
curl -X PUT -u username:password "http://device-ip/card?number=12345"
- DELETE
/card- Description: Remove a card from the database
- Parameters:
number(required): Card number (integer)
- Response:
200: Card number on success400: "Missing card number parameter" or "Invalid card number"500: "Failed to remove card"
- Authentication: Required
- CURL Example:
curl -X DELETE -u username:password "http://device-ip/card?number=12345"
- GET
/cards- Description: Get all cards in the database
- Response:
200- Plain text list of card numbers (one per line) - Authentication: Required
- CURL Example:
curl -u username:password http://device-ip/cards
- OPTIONS
/card- Description: CORS preflight request
- Response:
200- Empty response - Authentication: Required
- CURL Example:
curl -X OPTIONS -u username:password http://device-ip/card
- GET
/diagnostics/strike/status- Description: Get electrical status of a door strike
- Parameters:
number(required): Strike number (integer)
- Response:
200: "Good Electrical Connection" or "Bad connection or burnt out"400: "Missing strike number parameter" or "Invalid strike number"
- Authentication: Required
- CURL Example:
curl -u username:password "http://device-ip/diagnostics/strike/status?number=0"
- GET
/diagnostics/strike/current- Description: Get current draw of a door strike
- Parameters:
number(required): Strike number (integer)
- Response:
200: Current value as string400: "Missing strike number parameter" or "Invalid strike number"
- Authentication: Required
- CURL Example:
curl -u username:password "http://device-ip/diagnostics/strike/current?number=0"
- GET
/diagnostics/strike/connected- Description: Check if a door strike is properly connected
- Parameters:
number(required): Strike number (integer)
- Response:
200: "true" or "false"400: "Missing strike number parameter" or "Invalid strike number"
- Authentication: Required
- CURL Example:
curl -u username:password "http://device-ip/diagnostics/strike/connected?number=0"
- PUT
/diagnostics/strike/actuate- Description: Manually actuate a door strike for 5 seconds
- Parameters:
number(required): Strike number (integer)
- Response:
200: "OK"400: "Missing strike number parameter" or "Invalid strike number"
- Authentication: Required
- CURL Example:
curl -X PUT -u username:password "http://device-ip/diagnostics/strike/actuate?number=0"
- GET
/diagnostics/strikes- Description: Get list of available strikes
- Response:
200- Plain text list of strike numbers (one per line) - Authentication: Required
- CURL Example:
curl -u username:password http://device-ip/diagnostics/strikes
- GET
/diagnostics/cardreader/current- Description: Get current draw of a card reader
- Parameters:
number(required): Reader number (integer)
- Response:
200: Current value as string400: "Missing reader number parameter" or "Invalid reader number"
- Authentication: Required
- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/current?number=0"
- GET
/diagnostics/cardreader/fuse- Description: Check if a card reader's fuse is good
- Parameters:
number(required): Reader number (integer)
- Response:
200: "true" or "false"400: "Missing reader number parameter" or "Invalid reader number"
- Authentication: Required
- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/fuse?number=0"
- GET
/diagnostics/cardreader/list- Description: Get list of available card readers
- Response:
200- Plain text list of reader numbers (one per line) - Authentication: Required
- CURL Example:
curl -u username:password http://device-ip/diagnostics/cardreader/list
- GET
/diagnostics/cardreader/wiegand/burst- Description: Get the last Wiegand burst data from a card reader
- Parameters:
number(required): Reader number (integer)
- Response:
200: JSON object containing burst data400: "Missing reader number parameter" or "Invalid reader number"
- Headers:
Access-Control-Allow-Origin: * - Authentication: Required
- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/wiegand/burst?number=0"
- GET
/access- Description: Get the contents of the access log
- Response:
200- Plain text log contents - Authentication: Required
- CURL Example:
curl -u username:password http://device-ip/access
The server includes several URL rewrites for RESTful-style endpoints:
/card/{number}→/card?number={number}- CURL Example:
curl -u username:password "http://device-ip/card/12345"
- CURL Example:
/diagnostics/strike/{number}/status→/diagnostics/strike/status?number={number}- CURL Example:
curl -u username:password "http://device-ip/diagnostics/strike/0/status"
- CURL Example:
/diagnostics/strike/{number}/current→/diagnostics/strike/current?number={number}- CURL Example:
curl -u username:password "http://device-ip/diagnostics/strike/0/current"
- CURL Example:
/diagnostics/strike/{number}/connected→/diagnostics/strike/connected?number={number}- CURL Example:
curl -u username:password "http://device-ip/diagnostics/strike/0/connected"
- CURL Example:
/diagnostics/strike/{number}/actuate→/diagnostics/strike/actuate?number={number}- CURL Example:
curl -X PUT -u username:password "http://device-ip/diagnostics/strike/0/actuate"
- CURL Example:
/diagnostics/cardreader/{number}/current→/diagnostics/cardreader/current?number={number}- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/0/current"
- CURL Example:
/diagnostics/cardreader/{number}/fuse→/diagnostics/cardreader/fuse?number={number}- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/0/fuse"
- CURL Example:
/diagnostics/cardreader/{number}/wiegand/burst→/diagnostics/cardreader/wiegand/burst?number={number}- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/0/wiegand/burst"
- CURL Example:
/diagnostics/cardreader/current→/diagnostics/cardreader/current?number=0- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/current"
- CURL Example:
/diagnostics/cardreader/fuse→/diagnostics/cardreader/fuse?number=0- CURL Example:
curl -u username:password "http://device-ip/diagnostics/cardreader/fuse"
- CURL Example:
All endpoints return appropriate HTTP status codes:
200: Success400: Bad Request (missing or invalid parameters)500: Internal Server Error (database or system failures)
- All endpoints require HTTP Basic Authentication
- Numeric parameters are validated to ensure they're within valid ranges
- The server runs on port 80
- CORS headers are added for the Wiegand burst endpoint
- Static files are served from LittleFS filesystem
# Replace with your actual credentials
curl -u username:password http://device-ip/# Add card
curl -X PUT -u username:password "http://device-ip/card?number=12345"
# Remove card
curl -X DELETE -u username:password "http://device-ip/card?number=12345"
# List all cards
curl -u username:password http://device-ip/cards# Check strike 0 status
curl -u username:password "http://device-ip/diagnostics/strike/0/status"
# Actuate strike 0
curl -X PUT -u username:password "http://device-ip/diagnostics/strike/0/actuate"
# Check reader 0 fuse
curl -u username:password "http://device-ip/diagnostics/cardreader/0/fuse"
# Get access log
curl -u username:password http://device-ip/access