API
Base Information
Base URL:
http://<your-server-address>/apiData Format: JSON
Authentication: JWT (user login state is managed via
session)
User Authentication
User Signup
URL:
/api/signupMethod:
POSTRequest Body:
{ "username": "your_username", "password": "your_password" }
Success Response:
{ "message": "User created", "username": "your_username" }
- Error Responses:
400: Missing username or password400: Username already exists
User Login
URL:
/api/loginMethod:
POSTRequest Body:
{ "username": "your_username", "password": "your_password" }
Success Response:
{ "message": "Logged in", "username": "your_username" }
- Error Responses:
400: Missing username or password401: Invalid username or password
User Logout
URL:
/api/logoutMethod:
POSTSuccess Response:
{ "message": "Logged out" }
Task Configuration
Get Task Configuration
URL:
/api/tasksMethod:
GETSuccess Response:
{ "task_type_1": { "benchmark_1": { "model_1": ["language_1", "language_2"] } } }
- Error Response:
500: Failed to load task configuration
Data Loading
Get Data
URL:
/api/dataMethod:
POSTRequest Body:
{ "task": "task_type", "benchmark": "benchmark_name", "model": "model_name", "language": "language_code" }
Success Response:
[ { "entry_id": "task-benchmark-model-language-0001", "field_1": "value_1", "field_2": "value_2" } ]
- Error Responses:
400: Missing parameters404: Data file not found500: Failed to read file
Annotations
Save Annotation
URL:
/api/annotationMethod:
POSTRequest Body:
{ "entry_id": "task-benchmark-model-language-0001", "row_data": { ... }, "annotations": [ { "errorType": "error_type", "start": 0, "end": 10 } ] }
Success Response:
{ "message": "X annotations saved." }
- Error Responses:
401: Unauthenticated500: Database error
Translation
Translate Text
URL:
/api/translateMethod:
POSTRequest Body:
{ "text": "Text to translate", "target_lang": "es" }
Success Response:
{ "translated_text": "Translated text", "target_lang": "es" }
- Error Responses:
400: Missing text or unsupported target language500: Translation failed
Data Export
Export Data
URL:
/api/exportMethod:
GETResponse: Returns a JSON file containing all annotations and comments.
Feedback
Get Feedback
URL:
/api/feedbackMethod:
POSTRequest Body:
{ "entry_id": "task-benchmark-model-language-0001", "username": "user1" }
Success Response:
{ "id": 1, "username": "user1", "entry_id": "task-benchmark-model-language-0001", "question": "What is this?", "comment": "This is a comment.", "rating": 5, "timestamp": "2023-10-01T12:00:00Z" }
- Error Responses:
400: Missing parameters404: Feedback not found
Comments
Get Comments
URL:
/api/commentsMethod:
GETSuccess Response:
Add Comment
URL:
/api/commentsMethod:
POSTRequest Body:
Success Response:
Edit Comment
URL:
/api/comments/<comment_id>Method:
PUTRequest Body:
Success Response:
Delete Comment
URL:
/api/comments/<comment_id>Method:
DELETESuccess Response: