APIs for Funding ARB Analytics

Endpoints

1. Logging In (***Required First Step ***)

  • Endpoint: /login

  • Method: POST

  • Description: login and retrieve JWT token

a. Request

  • Headers: Content-Type: application/json

  • Query Parameters: None

  • Body:

    • username (string): The username of the user.

    • password (string): The password of the user.

b. Responce

  • Status Code: 200 OK

  • Body:

{ "access_token": "<access_token>", "refresh_token": "<refresh_token>" }

c. Example

2. Get Raw Data Table (requires JWT token)

  • Endpoint: /raw_data_table

  • Method: GET

  • Description: Retrieves all records from the raw_data_table.

a. Request

  • Headers: None

  • Query Parameters: None

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: JSON array of objects containing the raw data records.

c. Example

d. Response Example

3.1 Get Portfolio Track Records (requires JWT token)

  • Endpoint: /portfolio_track_records

  • Method: GET

  • Description: Retrieves all records from the portfolio_track_records table.

a. Request

  • Headers: None

  • Query Parameters:

  • - page (optional): The page number to retrieve. Defaults to all records if not provided.

  • - limit (optional): The number of records per page. Defaults to all records if not provided.

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: JSON array of objects containing the portfolio track records.

c. Example

d. Response Example

3.2 Get Latest Portfolio Data food a time range (requires JWT token)

  • Endpoint: /track_records_daily_latest

  • Method: GET

  • Description: retrieves the latest records for each day up to 1:00 UTC within a specified date range. If no date range is provided, it fetches the latest records up to 1:00 UTC for all available days.

a. Request

  • Headers: None

  • Query Parameters:

  • - start_date (optional, string, format: YYYY-MM-DD

  • - The start date of the range from which to fetch records.

  • - Example: 2024-08-03

  • - end_date (optional, string, format: YYYY-MM-DD)

  • - The end date of the range up to which to fetch records.

  • - Example: 2024-09-02

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: JSON array of objects containing the track of records data.

c. Example

4. Get Portfolio Latest Data (requires JWT token)

  • Endpoint: /portfolio_latest

  • Method: GET

  • Description: Retrieves all records from the portfolio_latest table.

a. Request

  • Headers: None

  • Query Parameters: None

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: JSON array of objects containing the latest portfolio data.

c. Example

d. Response Example

5. Get Monitor APR Attribute Data (requires JWT token)

  • Endpoint: /monitor_apr_attribute

  • Method: GET

  • Description: Retrieves all records from the monitor_apr_attribute table.

a. Request

  • Headers: None

  • Query Parameters: None

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: JSON array of objects containing the monitor APR attribute data.

c. Example

d. Response Example

6. Refresh Token

  1. Endpoint: /refresh

  2. Method: POST

  3. Description: This endpoint allows a user to refresh their access token using a valid refresh token.

a. Request

  • Headers

    • Authorization: Bearer <refresh_token>

    • Content-Type: application/json

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: {"access_token": "<new_access_token>"}

7. Trigger Cloud Function DataSync

  1. Endpoint: /run_dataSync

  2. Method: GET

  3. Description: Triggers the dataSync function to fetch data and store into database

a. Request

  • Headers: None

  • Query Parameters: None

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: None

8. Trigger Cloud Run Monitor

  1. Endpoint: /run_monitor

  2. Method: GET

  3. Description: Triggers the monitor instance to fetch data and store into database

a. Request

  • Headers: None

  • Query Parameters: None

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: None

9. Trigger Cloud Run Portfolio

  1. Endpoint: /run_portfolio

  2. Method: GET

  3. Description: Triggers the portfolio instance to fetch data and store into database

a. Request

  • Headers: None

  • Query Parameters: None

  • Body: None

b. Response

  • Status Code: 200 OK

  • Body: None

Last updated