diff --git a/README.txt b/README.txt index 5e349dc..cce264e 100644 --- a/README.txt +++ b/README.txt @@ -85,9 +85,45 @@ Files: main/api.php - Message API API usage: + +GET /api.php - Get messages + Parameters: + - limit: number of messages (1-100, default: 50) + + Example: + curl http://localhost/api.php?limit=10 + + Response: + { + "messages": [ + { + "username": "user", + "message": "text", + "created_at": "2024-03-21 12:34:56", + "signature": "[Signed]", + "is_encrypted": true + } + ] + } + +POST /api.php - Send message + Headers: + - Content-Type: application/json + + Body: + { + "username": "name", + "message": "text", + "signature": "pgp_signature", + "encrypted": true + } + + Example: curl -X POST http://localhost/api.php -H "Content-Type: application/json" -d '{ "username": "name", "message": "text", "signature": "pgp_signature", "encrypted": true - }' \ No newline at end of file + }' + + Note: Messages can only be sent by unregistered usernames \ No newline at end of file