From 0a00b2e8e8400bd174209be8888a3fb2d9e3f01c Mon Sep 17 00:00:00 2001 From: Jordon Brooks <16258926+Jordonbc@users.noreply.github.com> Date: Mon, 26 Jun 2023 20:37:01 +0100 Subject: [PATCH] Updated Endpoints (markdown) --- Endpoints.md | 143 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 129 insertions(+), 14 deletions(-) diff --git a/Endpoints.md b/Endpoints.md index 9bc8ea0..9333a67 100644 --- a/Endpoints.md +++ b/Endpoints.md @@ -1,20 +1,135 @@ -http://localhost:9000/v1/are_you_there -Body: yes +# HarmonyLinkServer API Documentation -http://127.0.0.1:9000/v1/all_info -Body: {"os":{"platform":"WINDOWS","name":"Windows 11 Core","version":"10.0.22621","bits":"X86_64"},"battery":{"has_battery":false,"battery_percent":0,"charging_status":"UNKNOWN"},"dock":{"dock_info":{"brand":"","model":"","usb_ids":[]},"is_docked":true,"fallback_detection":false},"version":{"build_timestamp":"2023-06-25T22:42:16.697662700Z","git_branch":"feature/Versioned_API","git_describe":"release_1.0.0-11-gba6bde2","git_commit_timestamp":"2023-06-25T12:38:11.000000000+01:00","debug":true,"version":"0.1.0","version_major":0,"version_minor":1,"version_patch":0,"version_pre":"","supported_api_versions":["v1"]}} +## Endpoints -http://localhost:9000/v1/os_info -Body: {"platform":"WINDOWS","name":"Windows 11 Core","version":"10.0.22621","bits":"X86_64"} +### 1. Are You There +A simple endpoint that checks if the server is up and running. -http://localhost:9000/v1/battery_info -Body: {"has_battery":false,"battery_percent":0,"charging_status":"UNKNOWN"} +- **URL:** `/v1/are_you_there` +- **Method:** `GET` +- **Response:** A simple "yes" response. -http://localhost:9000/v1/version_info -Body: {"build_timestamp":"2023-06-25T22:42:16.697662700Z","git_branch":"feature/Versioned_API","git_describe":"release_1.0.0-11-gba6bde2","git_commit_timestamp":"2023-06-25T12:38:11.000000000+01:00","debug":true,"version":"0.1.0","version_major":0,"version_minor":1,"version_patch":0,"version_pre":"","supported_api_versions":["v1"]} +### 2. All Info +Returns a JSON object containing information about various aspects of the system, including OS, battery, dock, and version information. -http://localhost:9000/v1/dock_info -Body: {"brand":"","model":"","usb_ids":[]} +- **URL:** `/v1/all_info` +- **Method:** `GET` +- **Sample Response:** + ```json + { + "os": { + "platform": "WINDOWS", + "name": "Windows 11 Core", + "version": "10.0.22621", + "bits": "X86_64" + }, + "battery": { + "has_battery": false, + "battery_percent": 0, + "charging_status": "UNKNOWN" + }, + "dock": { + "dock_info": { + "brand": "", + "model": "", + "usb_ids": [] + }, + "is_docked": true, + "fallback_detection": false + }, + "version": { + "build_timestamp": "2023-06-25T22:42:16.697662700Z", + "git_branch": "feature/Versioned_API", + "git_describe": "release_1.0.0-11-gba6bde2", + "git_commit_timestamp": "2023-06-25T12:38:11.000000000+01:00", + "debug": true, + "version": "0.1.0", + "version_major": 0, + "version_minor": 1, + "version_patch": 0, + "version_pre": "", + "supported_api_versions": ["v1"] + } + } + ``` -http://localhost:9000/api/supported_versions -Body: ["v1"] \ No newline at end of file +### 3. OS Info +Returns a JSON object containing information about the operating system. + +- **URL:** `/v1/os_info` +- **Method:** `GET` +- **Sample Response:** + ```json + { + "platform": "WINDOWS", + "name": "Windows 11 Core", + "version": "10.0.22621", + "bits": "X86_64" + } + ``` + +### 4. Battery Info +Returns a JSON object containing information about the battery status. + +- **URL:** `/v1/battery_info` +- **Method:** `GET` +- **Possible Charging Status:** "UNKNOWN", "BATTERY", "CHARGING" +- **Sample Response:** + ```json + { + "has_battery": false, + "battery_percent": 0, + "charging_status": "UNKNOWN" + } + ``` + +### 5. Version Info +Returns a JSON object containing information about the version of the server application. + +- **URL:** `/v1/version_info` +- **Method:** `GET` +- **Sample Response:** + ```json + { + "build_timestamp": "2023-06-25T22:42:16.697662700Z", + "git_branch": "feature/Versioned_API", + "git_describe": "release_1.0.0-11-gba6bde2", + "git_commit_timestamp": "2023-06-25T12:38:11.000000000+01:00", + "debug": true, + "version": "0.1.0", + "version_major": 0, + ```markdown + "version_minor": 1, + "version_patch": 0, + "version_pre": "", + "supported_api_versions": ["v1"] + } + ``` + +### 6. Dock Info +Returns a JSON object containing information about the dock. + +- **URL:** `/v1/dock_info` +- **Method:** `GET` +- **Sample Response:** + ```json + { + "dock_info": { + "brand": "", + "model": "", + "usb_ids": [] + }, + "is_docked": true, + "fallback_detection": false + } + ``` + +### 7. Supported Versions +Returns an array containing the versions of the API that are currently supported. + +- **URL:** `/api/supported_versions` +- **Method:** `GET` +- **Sample Response:** + ```json + ["v1"] + ```