Skip to content

API Documentation

Ethan Janicki edited this page Sep 17, 2023 · 3 revisions

API Endpoints

User API Documentation

This document provides a brief overview of the API endpoints related to the 'user' in our application.

Create a New User [POST /user/create]

This endpoint is used to create a new user in our system.

Request Body

  • first_name: The user's first name.
  • last_name: The user's last name.
  • password: User's password.
  • income: User's income.
  • location: User's location.
  • Debt_IDs: A list of debt identifier that user owns.
  • investment_IDs: A list of investment identifier that user has made.

Response

  • The newly created user data.

Get User by ID [GET /user/:id]

This endpoint is used to get the user's data by ID.

Request Parameter

  • id: The ID of the user you want to retrieve.

Response

  • The user data.

Update User [PUT /user/:id]

This endpoint is used to update an existing user.

Request Parameters

  • id: The ID of the user you want to update.

Request Body

  • The fields you want to update.

Response

  • The updated user data.

Add Debt ID to User [PUT /user/:id/addDebt]

This endpoint is used to add a Debt ID to the list of debt IDs in user.

Request Parameters

  • id: The ID of the user you want to add debt to.

Request Body

  • Debt_IDs: An array containing the ID(s) of the new debt(s) you want to add.

Response

  • The updated user data with the added debt ID.

Please reach out if you have any problems or require further clarifications using these endpoints.

Investment API Documentation

This document offers a concise summary of the API endpoints related to 'investment' in our application.

Create New Investment [POST /investment/create]

This endpoint is used to create a new investment in our system.

Request Body

  • index_fund_ID: The ID of the index fund in which the investment is made.
  • shares: The number of shares purchased.
  • initial_dollar_amount: The initial dollar amount invested.
  • initial_investment_date: The date when the initial investment was made.

Response

  • The newly created investment data.

Get Investment by ID [GET /investment/:id]

This endpoint enables you to retrieve a particular investment using its ID.

Request Parameter

  • id: The ID of the investment you wish to retrieve.

Response

  • The requested investment data.

Update Investment [PUT /investment/:id]

This endpoint is used to update an existing investment's details.

Request Parameters

  • id: The ID of the investment you intend to update.

Request Body

  • The fields that you wish to update.

Response

  • The updated investment data.

Delete Investment [DELETE /investment/:id]

This endpoint is used to delete a particular investment using its ID.

Request Parameters

  • id: The ID of the investment you wish to delete.

Response

  • The data of the investment that was deleted.

Add Investment ID [PUT /investment/:id/addInvestment]

This endpoint is used to add an investment ID to the list of investment IDs.

Request Parameters

  • id: The ID of the investment you wish to relate to.

Request Body

  • investment_IDs: An array containing the new investment ID(s) you wish to add.

Response

  • The updated investment data with the new investment ID listed.

Feel free to reach out if you encounter any issues or need further clarification on these endpoints.

Debt API Documentation

This document presents a brief overview of the API endpoints related to the 'debt' in our application.

Create New Debt [POST /debt/create]

This endpoint allows you to create a new debt our system.

Request Body

  • name: The name of the debt.
  • amount: The amount of the debt.
  • interest: The interest rate on the debt.
  • category: The category of the debt.

Response

  • The newly created debt data.

Get Debt by ID [GET /debt/:id]

This endpoint allows you to retrieve a specific debt using its ID.

Request Parameter

  • id: The ID of the debt you wish to retrieve.

Response

  • The debt data.

Update Debt [PUT /debt/:id]

This endpoint is used to update the details of an existing debt.

Request Parameters

  • id: The ID of the debt you want to update.

Request Body

  • The fields you want to update.

Response

  • The updated debt data.

Delete Debt [DELETE /debt/:id]

This endpoint is used to delete a specific debt using its ID.

Request Parameters

  • id: The ID of the debt you wish to delete.

Response

OpenAI Router Documentation

This document outlines the usage of the endpoints that are integrated into the OpenAI Router. There are two routes that are created for different versions of the GPT models - gpt4 and gpt3.

End Point 1: /gpt4

This endpoint will provide you with the response from the GPT-4 chatbot.

Request Type: POST

Predictor Input:

  • prompt: Contains the opening text sent by the system. This could be a brief description for the tasks to be performed.
  • input: The user's question or reply to the prompt text.

Output:

The API will return the content provided by the GPT-4 model.

Example Usage:

POST /gpt4

{
 "prompt": "Translate the following English text to French:",
 "input": "Hello, how are you?"
}

End Point 2: /gpt3

This endpoint will provide you with the response from the GPT-3.5-turbo chatbot.

Request Type: POST

Predictor Input:

  • prompt: Contains the opening text sent by the system. This again is a brief description for the tasks to be performed.
  • input: The user's question or reply to the prompt text.

Output:

This API will return the content that is provided by the GPT-3.5-turbo model.

Example Usage:

POST /gpt3

{
 "prompt": "Translate the following English text to Spanish:",
 "input": "Hello, how are you?"
}

Error Handling:

For both the /gpt4 and /gpt3, if the server or the model encounters an error, this error will be logged into the console for debugging.

Concluding Note:

Please ensure that your OpenAI API key is stored safely in your .env file and that the names are correctly referenced.

Should you encounter any issues or require deeper clarification regarding these endpoints, please feel free to reach out.