-
Notifications
You must be signed in to change notification settings - Fork 0
Module: api_gateway
Tanmay Sawaji edited this page Feb 8, 2022
·
3 revisions
API Gateway is a gateway that separates the user interface from other microservices. The purpose of the gate is to validate incoming requests, routing requests to the backend services, and return an appropriate response to the client UI. The service exposes its endpoint to the following services:
- UI component
- DB middleware
The service will be running on port - 5000
Following are the endpoints exposed to
- UI component
Request:
No parameters
Response:
{ "station_name": ['DAN1', 'KABR', 'KABX', ...], "time": ['00:00:00 - 00:05:59', '00:06:00 - 00:11:59', ...], "property": [ 'Reflectivity'] }
Request:
{ "user_email":"[email protected] }
Response:
{ "error_code": "0", "error_message": "Information retrieved", "request_details": [ { "_id": "6201ae94a0aa8bcdb7ad97bf", "user_email": "[email protected]", "request_id": "DAN1_02022022_000000_002959_Reflectivity", "status": "0", "time_stamp": "1644277396", "property": "Reflectivity", "__v": 0 } ] }
Request:
{ “station_name” : "DAN1", “date” : "02-02-2022", “time” : ”00:00:00 - 00:29:59”, “user_email” : "[email protected]", “property” : "Reflectivity" }
Response:
{ "response_code": "0", "response_message": "Information retrieved", "data_dump": [ { "_id": "6201ae94a0aa8bcdb7ad97bf", "user_email": "[email protected]", "request_id": "DAN1_02022022_000000_002959_Reflectivity", "status": "0", "time_stamp": "1644277396", "property": "Reflectivity", "__v": 0 } ], "data_status": "true/false" }
Request:
{ "request_id" : "KAKQ_02012022_003000_005959_Reflectivity", "user_email" : "[email protected]", "property" : "Reflectivity" }
Response:
{ "response_code": "0", "response_message": "Information retrieved", "data": [ { "_id": "6201af9ba0aa8bcdb7ad97f1", "request_id": "KAKQ_02012022_003000_005959_Reflectivity", "start_time": "003000", "end_time": "005959", "__v": 0, "lat": { "_id": "6201af9ba0aa8bcdb7ad97f2", "parent_doc_ref": "6201af9ba0aa8bcdb7ad97f1", "lat": [[],[]....], "__v": 0 }, "long": { "_id": "6201af9ba0aa8bcdb7ad97f3", "parent_doc_ref": "6201af9ba0aa8bcdb7ad97f1", "long": [[],[]....], "__v": 0 }, "reflectivity": { "_id": "6201af9ba0aa8bcdb7ad97f4", "parent_doc_ref": "6201af9ba0aa8bcdb7ad97f1", "data": [[],[]....], "__v": 0 } } ] }
- DB Middleware
NOTE: All the endpoints are POST requests
Request:
{ "user_email":"[email protected]" }
Response:
{ "status": "success", "message": "Information retrieved", "requests": [ { "_id": "6201ae94a0aa8bcdb7ad97bf", "user_email": "[email protected]", "request_id": "DAN1_02022022_000000_002959_Reflectivity", "status": "0", "time_stamp": "1644277396", "property": "Reflectivity", "__v": 0 } ] }
Request:
{ "request_id":"DAN1_02022022_000000_002959_Reflectivity" }
Response:
{ "status": "success", "message": "Information retrieved", "requests": [ { "_id": "6201ae94a0aa8bcdb7ad97bf", "user_email": "[email protected]", "request_id": "DAN1_02022022_000000_002959_Reflectivity", "status": "0", "time_stamp": "1644277396", "property": "Reflectivity", "__v": 0 } ], "data_status": "true/false" }
data_status - 1. true - means the data for the request already exists in the database no need to download data from S3 2. false - data doesn't exist in the database
Request:
{ "user_email": "[email protected]", "request_id":"KAKQ_02022022_000000_002959_Reflectivity", "property":"reflectivity", "time_stamp":"1644090027" }
Response:
{ status: "success/error", message: "Insertion successful/Insertion failed" }
Request:
{ "request_id":"KAKQ_02012022_003000_005959_Reflectivity" }
Response:
{ "data": [ { "_id": "6201af9ba0aa8bcdb7ad97f1", "request_id": "KAKQ_02012022_003000_005959_Reflectivity", "start_time": "003000", "end_time": "005959", "__v": 0, "lat": { "_id": "6201af9ba0aa8bcdb7ad97f2", "parent_doc_ref": "6201af9ba0aa8bcdb7ad97f1", "lat": [[],[]....], "__v": 0 }, "long": { "_id": "6201af9ba0aa8bcdb7ad97f3", "parent_doc_ref": "6201af9ba0aa8bcdb7ad97f1", "long": [[],[]....], "__v": 0 }, "reflectivity": { "_id": "6201af9ba0aa8bcdb7ad97f4", "parent_doc_ref": "6201af9ba0aa8bcdb7ad97f1", "data": [[],[]....], "__v": 0 } } ] }