Welcome to the BodmasParser API documentation. This API allows you to parse and evaluate mathematical expressions, validate expressions, and perform health checks.
All API endpoints are relative to: https://bodmasparser.onrender.com
For interactive Swagger documentation, visit: https://bodmasparser.onrender.com/docs
Parse and evaluate a mathematical expression. This endpoint takes a mathematical expression, validates it, converts it to postfix notation, builds a parse tree, and evaluates the result.
Name | Type | Required | Description |
---|---|---|---|
expression | string | Yes | A mathematical expression to parse and evaluate (e.g., "3+4*5") |
Status | Description |
---|---|
200 OK | Expression successfully parsed and evaluated |
400 Bad Request | Invalid expression or parsing error |
Request:
Response:
Validate a mathematical expression without parsing or evaluating it.
Name | Type | Required | Description |
---|---|---|---|
expression | string (path parameter) | Yes | A mathematical expression to validate (e.g., "3+4*5") |
Status | Description |
---|---|
200 OK | Validation successful |
400 Bad Request | Validation error |
Request:
Response:
Simple health check endpoint to verify that the API is operational.
Status | Description |
---|---|
200 OK | API is operational |
Root endpoint that provides basic information about the API.
Status | Description |
---|---|
200 OK | API information retrieved successfully |
The API returns appropriate HTTP status codes and detailed error messages for different types of errors:
Error Type | HTTP Status | Response Format |
---|---|---|
Invalid Expression | 200 OK (with valid=false) |
{
"postfix": [],
"parse_tree": {},
"result": 0.0,
"input_expression": "invalid-expression",
"valid": false,
"error": "Specific error message"
}
|
Invalid Request | 400 Bad Request |
{
"detail": "Error message"
}
|