All API requests should be sent to: https://door.ammaar.xyz/api
Most endpoints require authentication. Include the JWT token in the Authorization header: Authorization: Bearer <your_jwt_token>
- URL:
/login
- Method:
POST
- Auth required: No
- Data constraints:
{
"password": "[valid password string]"
}
- Code:
200
- Content :
{ "message": "Login successful", "token": "[JWT Token]" }
- URL:
/status
- Method:
GET
- Auth required:
Yes
- Success Response:
- Code:
200
- Content :
{ "message": "Login successful", "token": "[JWT Token]" }
- Code:
- URL:
/command
- Method:
POST
- Auth required: Yes
- Data Constraints:
{
"command": "[open|close]"
}
- Success Response:
- Code:
200
- Content :
Command sent successfully}
- Code:
- URL:
/emergency-close
- Method:
POST
- Auth required: Yes
- Success Response:
- Code:
200
- Content :
Emergency close Command sent successfully}
- Code:
-
Condition: If not authenticated or invalid token
- Code:
403
- Content:
{ "message": "Not authenticated" }
- Code:
-
Condition: If internal server error
- Code:
500
- Content:
Internal Server Error
- Code:
curl -X POST https://door.ammaar.xyz/api/login -H "Content-Type: application/json" -d '{"password":"your_password"}'
curl https://door.ammaar.xyz/api/status -H "Authorization: Bearer YOUR_JWT_TOKEN"
curl -X POST https://door.ammaar.xyz/api/command -H "Authorization: Bearer YOUR_JWT_TOKEN" -H "Content-Type: application/json" -d '{"command":"open"}'