0% found this document useful (0 votes)
5 views

api_endpoints_with_errors

The document outlines API endpoints for registering and logging in students, detailing the required request bodies for each endpoint. It also specifies the structure of API responses and common error responses with corresponding status codes and messages. The documentation is designed to assist developers in integrating with the API effectively.

Uploaded by

prabashanadinith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

api_endpoints_with_errors

The document outlines API endpoints for registering and logging in students, detailing the required request bodies for each endpoint. It also specifies the structure of API responses and common error responses with corresponding status codes and messages. The documentation is designed to assist developers in integrating with the API effectively.

Uploaded by

prabashanadinith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

API Endpoints & Response Documentation

1. Register Endpoint
Endpoint: POST /api/register
Description: This endpoint is used to register a student.

Request Body:
{
"schoolId": 1073741824,
"gradeId": 1073741824,
"classId": 1073741824,
"studentId": "string",
"nic": "923176191v",
"firstName": "string",
"lastName": "string",
"middleName": "string",
"nameWithInitial": "string",
"forename": "string",
"surname": "string",
"gender": 1,
"date": "2025-02-15T14:14:35.082Z",
"homeAddress": "string",
"nationalityId": 1073741824,
"provinceId": 1073741824,
"districtId": 1073741824,
"cityId": 1073741824,
"phoneNumber": "1032260898",
"whatsappNumber": "4098230050",
"email": "string",
"relationId": 1073741824,
"guardianName": "string",
"guardianNic": "473345391v",
"guardianContact": "4127255581",
"guardianString": "string",
"occupation": "string",
"streamId": 1073741824,
"subjectSt1Id": 1073741824,
"subjectSt2Id": 1073741824,
"subjectSt3Id": 1073741824,
"password": "stringst"
}

2. Login Endpoint
Endpoint: POST /api/login
Description: This endpoint allows a user to log in.

Request Body:
{
"credential": "string",
"password": "string"
}

3. API Response Structure


All API responses follow the below structure:
{
"status": "string",
"code": 200,
"message": "string",
"data": {},
"metadata": {
"timestamp": "2025-02-15T14:14:35.082Z",
"version": "1.0"
}
}

4. Common Error Responses


400 - Bad Request
{
"status": "error",
"code": 400,
"message": "Invalid input data",
"data": {},
"metadata": {
"timestamp": "2025-02-15T14:14:35.082Z",
"version": "1.0"
}
}

401 - Unauthorized
{
"status": "error",
"code": 401,
"message": "Invalid credentials",
"data": {},
"metadata": {
"timestamp": "2025-02-15T14:14:35.082Z",
"version": "1.0"
}
}

403 - Forbidden
{
"status": "error",
"code": 403,
"message": "Access denied",
"data": {},
"metadata": {
"timestamp": "2025-02-15T14:14:35.082Z",
"version": "1.0"
}
}

404 - Not Found


{
"status": "error",
"code": 404,
"message": "Resource not found",
"data": {},
"metadata": {
"timestamp": "2025-02-15T14:14:35.082Z",
"version": "1.0"
}
}

500 - Internal Server Error


{
"status": "error",
"code": 500,
"message": "Internal server error",
"data": {},
"metadata": {
"timestamp": "2025-02-15T14:14:35.082Z",
"version": "1.0"
}
}

You might also like