Skip to content

Endpoints

Damian Loch edited this page Jul 2, 2024 · 1 revision

API Endpoints Documentation

Overview

This documentation provides details about the API endpoints available and how to interact with them using Postman.

Health Check Endpoint

GET /health-check

Checks the health status of the application.

Response

  • 200 OK: Health status information.

Example

GET http://localhost:8000/health-check

Task Result Endpoint

GET /task/{task_id}

Retrieves the result of a task based on its ID.

Path Parameters

  • task_id (string): The ID of the task.

Response

  • 200 OK: Task status and result information.

Example

GET http://localhost:8000/task/12345

Load Data by Path Endpoint

POST /load_by_path

Initiates a task to load data from a specified path.

Request Body

  • input (Load): Object containing the filepath.

Response

  • 202 Accepted: Task accepted.
  • 400 Bad Request: File type not implemented.

Example

POST http://localhost:8000/load_by_path Content-Type: application/json

{ "filepath": "/path/to/file" }

Office 365 Authorization Endpoint

GET /office_auth

Starts the authorization process for Office 365.

Response

  • 200 OK: Authorization URL.

Example

GET http://localhost:8000/office_auth

Token Endpoint

POST /token

Retrieves the access token using the authorization code.

Query Parameters

  • code (string): Authorization code.

Response

  • 200 OK: Access token and task ID.
  • 400 Bad Request: Authorization code not found.
  • 500 Internal Server Error: Error acquiring token.

Example

POST http://localhost:8000/token?code=auth_code_here

Load Model Endpoint

POST /load_model

Uploads a model and its configuration.

Request Body

  • model (file): The model file.
  • config (file): The configuration file.
  • description (string): Description of the model.

Response

  • 202 Accepted: Task accepted.
  • 400 Bad Request: File type not implemented.

Example

POST http://localhost:8000/load_model Content-Type: multipart/form-data

{ "model": , "config": , "description": "Model description" }

Get Inference Endpoint

POST /get_inference

Requests inference from a loaded model.

Request Body

  • model (string): The model name.
  • data (string): JSON string of input data.

Response

  • 200 OK: Inference results.
  • 400 Bad Request: Invalid JSON input.
  • 500 Internal Server Error: Model not valid.

Example

POST http://localhost:8000/get_inference Content-Type: application/json

{ "model": "model_name", "data": "{"key": "value"}" }

Query Endpoint

POST /query

Executes a query on the specified index.

Request Body

  • query (string): The query string.
  • index (string): The index to search.

Response

  • 200 OK: Query results.

Example

POST http://localhost:8000/query Content-Type: application/json

{ "query": "search query", "index": "index_name" }

Sort Documents Endpoint

POST /sort

Sorts documents based on the specified type.

Request Body

  • type (string): The type of sort (name, size, type, created).

Response

  • 200 OK: Sorted documents.

Example

POST http://localhost:8000/sort Content-Type: application/x-www-form-urlencoded

type=name

Google Drive Authentication Endpoint

GET /google_drive_auth

Starts the authentication process for Google Drive.

Response

  • 200 OK: Redirects to Google Drive authentication.

Example

GET http://localhost:8000/google_drive_auth

Google Drive Picker Endpoint

GET /picker

Displays the Google Drive picker for selecting files.

Response

  • 200 OK: HTML response for Google Picker.

Example

GET http://localhost:8000/picker

Selected File Endpoint

POST /selected_file

Handles the file selected in Google Picker.

Request Body

  • name (string): The name of the selected file.

Response

  • 200 OK: File selection confirmation.

Example

POST http://localhost:8000/selected_file Content-Type: application/json

{ "name": "selected_file_name" }

Done Endpoint

GET /done

Confirms the completion of file selection.

Response

  • 200 OK: Confirmation message.

Example

GET http://localhost:8000/done

Chat with Model Endpoint

POST /chat/{user_id}

Sends a chat message to the model and retrieves the response.

Path Parameters

  • user_id (string): The user ID.

Request Body

  • message (string): The chat message.

Response

  • 200 OK: Chat response.

Example

POST http://localhost:8000/chat/user123 Content-Type: application/json

{ "message": "Hello, how are you?" }

Get Chat History Endpoint

GET /chat_history/{user_id}/{history_id}

Retrieves the chat history for a user.

Path Parameters

  • user_id (string): The user ID.
  • history_id (int): The history ID.

Response

  • 200 OK: Chat history.

Example

GET http://localhost:8000/chat_history/user123/1

Get User Chat Histories Endpoint

GET /get_user_chat_histories/{user_id}

Retrieves all chat histories for a user.

Path Parameters

  • user_id (string): The user ID.

Response

  • 200 OK: List of chat history IDs.

Example

GET http://localhost:8000/get_user_chat_histories/user123

Ping Database Endpoint

POST /ping_database

Pings a specified database to check connectivity.

Request Body

  • database (string): The database type.
  • connectionString (string, optional): The connection string.
  • host (string, optional): The database host.
  • user (string, optional): The database user.
  • password (string, optional): The database password.

Response

  • 200 OK: Connectivity status.

Example

POST http://localhost:8000/ping_database Content-Type: application/json

{ "database": "mysql", "host": "localhost", "user": "root", "password": "password" }

Get Databases Endpoint

GET /databases/

Retrieves a list of all databases.

Response

  • 200 OK: List of databases.

Example

GET http://localhost:8000/databases/

Edit Connection Endpoint

POST /edit_connection/{connection_id}

Edits the connection details for a database.

Path Parameters

  • connection_id (string): The connection ID.

Request Body

  • database (string): The database type.
  • connectionString (string, optional): The connection string.
  • host (string, optional): The database host.
  • user (string, optional): The database user.
  • password (string, optional): The database password.

Response

  • 200 OK: Connectivity status.

Example

POST http://localhost:8000/edit_connection/12345 Content-Type: application/json

{ "database": "mysql", "host": "localhost", "user": "root", "password": "password" }

Delete Connection Endpoint

DELETE /delete_connection/{connection_id}

Deletes a database connection.

Path Parameters

  • connection_id (string): The connection ID.

Response

  • 200 OK: Deletion status.

Example

DELETE http://localhost:8000/delete_connection/12345

Load Query Endpoint

POST /load_query

Loads data from an uploaded file and starts a task.

Request Body

  • file (UploadFile): The file to be uploaded.

Response

  • 202 Accepted: Task accepted.
  • 500 Internal Server Error: Error while processing the file.

Example

POST http://localhost:8000/load_query Content-Type: multipart/form-data

{ "file": }

WebSocket Endpoint

WebSocket /ws/{filename}

Opens a WebSocket connection to receive progress updates.

Path Parameters

  • filename (string): The name of the file being uploaded.

Example

ws://localhost:8000/ws/filename

Clone this wiki locally