### Install Universal Speedtest (Next) Source: https://karel-kryda.gitbook.io/universal-speedtest/general/getting-started Installs the next release of the Universal Speedtest library from the NPM repository. ```bash npm install --save universal-speedtest@next ``` -------------------------------- ### Install Universal Speedtest (Stable) Source: https://karel-kryda.gitbook.io/universal-speedtest/general/getting-started Installs the stable release of the Universal Speedtest library from the NPM repository. ```bash npm install --save universal-speedtest ``` -------------------------------- ### Install Universal Speedtest (Development) Source: https://karel-kryda.gitbook.io/universal-speedtest/general/getting-started Installs the latest version of the Universal Speedtest library directly from the Git development branch. ```bash npm install --save github:karelkryda/universal-speedtest#build ``` -------------------------------- ### List Ookla Servers Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla This section details the `listOoklaServers` method, which retrieves a list of available Ookla test servers. It explains how to fetch a default number of servers or a custom limit. Examples are provided for both ESM and CommonJS. ```APIDOC ## List Ookla Servers ### Description Retrieves a list of available Ookla test servers. You can specify a limit for the number of servers to fetch. ### Method `GET` (internal) ### Endpoint `/` (Not applicable for library usage) ### Parameters #### Query Parameters - **serversToFetch** (number) - Optional - The maximum number of servers to fetch. Defaults to 100. ### Request Example ```javascript // ESM import { UniversalSpeedTest } from "universal-speedtest"; (async () => { const universalSpeedTest = new UniversalSpeedTest(); // List test servers (default limit of 100) const testServersDefault = await universalSpeedTest.listOoklaServers(); console.log(testServersDefault); // List test servers with a limit of 15 const testServersLimited = await universalSpeedTest.listOoklaServers(15); console.log(testServersLimited); })(); ``` ```javascript // CommonJS const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { const universalSpeedTest = new UniversalSpeedTest(); // List test servers (default limit of 100) const testServersDefault = await universalSpeedTest.listOoklaServers(); console.log(testServersDefault); // List test servers with a limit of 15 const testServersLimited = await universalSpeedTest.listOoklaServers(15); console.log(testServersLimited); })(); ``` ### Response #### Success Response (200) An array of server objects. Each object contains details like server name, location, country, and host. #### Response Example ```json [ { "name": "Server 1", "location": "City A, Country X", "country": "Country X", "host": "server1.example.com" }, { "name": "Server 2", "location": "City B, Country Y", "country": "Country Y", "host": "server2.example.com" } ] ``` ``` -------------------------------- ### Configure Universal Speedtest (CommonJS) Source: https://karel-kryda.gitbook.io/universal-speedtest/general/configuration Shows how to configure the Universal Speedtest library using the CommonJS module system. This example initializes the library with debug enabled, measurement of upload and download speeds, and sets the distance unit to kilometers before executing an Ookla speed test. ```javascript // This example shows how to configure the library. const { UniversalSpeedTest, DistanceUnits } = require('universal-speedtest'); (async () => { // Configure and run speedtest const universalSpeedTest = new UniversalSpeedTest({ debug: true, tests: { measureUpload: true, measureDownload: true }, units: { distanceUnit: DistanceUnits.km } }); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` -------------------------------- ### Perform Ookla Speedtest (with Specific Server) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla This section shows how to perform a speed test with a specific Ookla server. It involves searching for servers first and then using a selected server for the test. Examples are provided for both ESM and CommonJS. ```APIDOC ## Perform Ookla Speedtest (with Specific Server) ### Description Performs an internet speed test using a specific Ookla server found through a search query. ### Method `POST` (internal) ### Endpoint `/` (Not applicable for library usage) ### Parameters #### Request Body (Implicit for `searchOoklaServers` and `performOoklaTest`) - **location** (string) - Required - The location to search for test servers (e.g., "czechia"). - **testServer** (object) - Optional - A specific server object obtained from `searchOoklaServers` or `listOoklaServers`. ### Request Example ```javascript // ESM import { UniversalSpeedTest } from "universal-speedtest"; (async () => { const universalSpeedTest = new UniversalSpeedTest(); // Search test server const testServers = await universalSpeedTest.searchOoklaServers("czechia"); const testServer = testServers.at(2); // Select a server from the results // Run speedtest with the selected server const testResult = await universalSpeedTest.performOoklaTest(testServer); console.log(testResult); })(); ``` ```javascript // CommonJS const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { const universalSpeedTest = new UniversalSpeedTest(); // Search test server const testServers = await universalSpeedTest.searchOoklaServers("czechia"); const testServer = testServers.at(2); // Select a server from the results // Run speedtest with the selected server const testResult = await universalSpeedTest.performOoklaTest(testServer); console.log(testResult); })(); ``` ### Response #### Success Response (200) An object containing the speed test results, similar to the basic test, but associated with the specified server. #### Response Example ```json { "download": 95.1, "upload": 89.0, "ping": 14.8, "isp": "Example ISP", "server": { "name": "Specific Server Name", "location": "City, Country", "country": "Country", "host": "specific.server.com" } } ``` ``` -------------------------------- ### Perform Ookla Speedtest with Specific Server (ESM/CommonJS) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests Shows how to perform a speed test using a specific Ookla server found by searching for servers in a given country. The example searches for servers in 'czechia', selects one, and then uses it for the speed test. This allows for more targeted performance measurements. ```javascript // This example shows the basic use of the library. import { UniversalSpeedTest } from "universal-speedtest"; (async () => { const universalSpeedTest = new UniversalSpeedTest(); // Search test server const testServers = await universalSpeedTest.searchOoklaServers("czechia"); const testServer = testServers.at(2); // Run speedtest const testResult = await universalSpeedTest.performOoklaTest(testServer); console.log(testResult); })(); ``` ```javascript // This example shows the basic use of the library. const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { const universalSpeedTest = new UniversalSpeedTest(); // Search test server const testServers = await universalSpeedTest.searchOoklaServers("czechia"); const testServer = testServers.at(2); // Run speedtest const testResult = await universalSpeedTest.performOoklaTest(testServer); console.log(testResult); })(); ``` -------------------------------- ### Perform Ookla Speedtest (Basic Usage) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla Demonstrates the fundamental usage of the Universal Speedtest library to perform a speed test using Ookla servers. It initializes the library and initiates the test, logging the result. No external dependencies are required beyond the library itself. ```esm import { UniversalSpeedTest } from "universal-speedtest"; (async () => { // Run speedtest const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` ```commonjs const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { // Run speedtest const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` -------------------------------- ### Search Ookla Servers (JavaScript) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla Demonstrates how to use the searchOoklaServers function to find test servers. It shows searching with default limits and with a custom limit. ```javascript // This example shows the basic use of the search function. import { UniversalSpeedTest } from "universal-speedtest"; (async () => { // Search for test servers containing the specified keyword const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia"); console.log(testServers); // Search for test servers containing the specified keyword and limit the number of results to 15 const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia", 15); console.log(testServers); })(); ``` ```javascript // This example shows the basic use of the search function. const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { // Search for test servers containing the specified keyword const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia"); console.log(testServers); // Search for test servers containing the specified keyword and limit the number of results to 15 const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia", 15); console.log(testServers); })(); ``` -------------------------------- ### Perform Ookla Speedtest with Specified Server Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla Shows how to perform a speed test using a specific Ookla server found through a search query. It first searches for servers in a given location (e.g., 'czechia'), selects one from the results, and then uses it for the test. This allows for more targeted performance measurements. ```esm import { UniversalSpeedTest } from "universal-speedtest"; (async () => { const universalSpeedTest = new UniversalSpeedTest(); // Search test server const testServers = await universalSpeedTest.searchOoklaServers("czechia"); const testServer = testServers.at(2); // Run speedtest const testResult = await universalSpeedTest.performOoklaTest(testServer); console.log(testResult); })(); ``` ```commonjs const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { const universalSpeedTest = new UniversalSpeedTest(); // Search test server const testServers = await universalSpeedTest.searchOoklaServers("czechia"); const testServer = testServers.at(2); // Run speedtest const testResult = await universalSpeedTest.performOoklaTest(testServer); console.log(testResult); })(); ``` -------------------------------- ### Perform Ookla Speedtest (ESM/CommonJS) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests Demonstrates the basic usage of the Universal Speedtest library to perform a speed test using Ookla servers. It initializes the library and executes the speed test, logging the results. This function requires no specific server configurations. ```javascript // This example shows the basic use of the library. import { UniversalSpeedTest } from "universal-speedtest"; (async () => { // Run speedtest const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` ```javascript // This example shows the basic use of the library. const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { // Run speedtest const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` -------------------------------- ### List Ookla Servers Source: https://karel-kryda.gitbook.io/universal-speedtest/tests Lists available Ookla test servers. Optionally limits the number of servers returned. ```APIDOC ## GET /listOoklaServers ### Description Lists available Ookla test servers, with an option to limit the number of results. ### Method GET ### Endpoint /listOoklaServers ### Parameters #### Query Parameters - **serversToFetch** (number) - Optional - The maximum number of servers to return. Defaults to 100. ### Response #### Success Response (200) - **servers** (array) - An array of server objects. - **id** (number) - The server ID. - **url** (string) - The server URL. - **lat** (string) - The server latitude. - **lon** (string) - The server longitude. - **name** (string) - The server name. - **country** (string) - The server country. - **cc** (string) - The server country code. - **sponsor** (string) - The server sponsor. - **distance** (number) - The distance to the server. - **latency** (number) - The latency to the server. #### Response Example ```json [ { "id": 1234, "url": "http://example.com/speedtest", "lat": "40.7128", "lon": "-74.0060", "name": "New York", "country": "USA", "cc": "US", "sponsor": "Example Sponsor", "distance": 100, "latency": 50 }, { "id": 5678, "url": "http://another-example.com/speedtest", "lat": "52.5200", "lon": "13.4050", "name": "Berlin", "country": "Germany", "cc": "DE", "sponsor": "Example Telecom", "distance": 150, "latency": 60 } ] ``` ``` -------------------------------- ### Configure Universal Speedtest (ESM) Source: https://karel-kryda.gitbook.io/universal-speedtest/general/configuration Demonstrates how to initialize and configure the Universal Speedtest library using the ESM module system. It sets debug mode, enables upload and download measurements, and specifies kilometers as the distance unit before performing an Ookla speed test. ```javascript // This example shows how to configure the library. import { UniversalSpeedTest, DistanceUnits } from "universal-speedtest"; (async () => { // Configure and run speedtest const universalSpeedTest = new UniversalSpeedTest({ debug: true, tests: { measureUpload: true, measureDownload: true }, units: { distanceUnit: DistanceUnits.km } }); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` -------------------------------- ### Search Ookla Servers Source: https://karel-kryda.gitbook.io/universal-speedtest/tests Searches for Ookla test servers based on a specified location. Returns a list of available servers that match the search criteria. ```APIDOC ## POST /searchOoklaServers ### Description Searches for Ookla test servers based on a specified location. ### Method POST ### Endpoint /searchOoklaServers ### Parameters #### Query Parameters - **location** (string) - Required - The location to search for servers (e.g., 'New York', 'czechia'). ### Response #### Success Response (200) - **servers** (array) - An array of server objects matching the search criteria. - **id** (number) - The server ID. - **url** (string) - The server URL. - **lat** (string) - The server latitude. - **lon** (string) - The server longitude. - **name** (string) - The server name. - **country** (string) - The server country. - **cc** (string) - The server country code. - **sponsor** (string) - The server sponsor. - **distance** (number) - The distance to the server. - **latency** (number) - The latency to the server. #### Response Example ```json [ { "id": 5678, "url": "http://another-example.com/speedtest", "lat": "52.5200", "lon": "13.4050", "name": "Berlin", "country": "Germany", "cc": "DE", "sponsor": "Example Telecom", "distance": 150, "latency": 60 } ] ``` ``` -------------------------------- ### Search Ookla Servers using universal-speedtest (CommonJS) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests Searches for Ookla test servers using a specified keyword and optionally limits the number of results. It requires the 'universal-speedtest' library and returns an array of server objects. ```javascript // This example shows the basic use of the search function. const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { // Search for test servers containing the specified keyword const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia"); console.log(testServers); // Search for test servers containing the specified keyword and limit the number of results to 15 const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia", 15); console.log(testServers); })(); ``` -------------------------------- ### Perform Ookla Speedtest (Basic) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla This section demonstrates the basic usage of the Universal Speedtest library to perform a speed test using Ookla's servers. It covers both ESM and CommonJS module formats. ```APIDOC ## Perform Ookla Speedtest (Basic) ### Description Performs an internet speed test using Ookla's Speedtest.net servers. ### Method `POST` (internal) ### Endpoint `/` (Not applicable for library usage) ### Parameters None ### Request Example ```javascript // ESM import { UniversalSpeedTest } from "universal-speedtest"; (async () => { const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` ```javascript // CommonJS const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); console.log(testResult); })(); ``` ### Response #### Success Response (200) An object containing the speed test results (download, upload, ping, etc.). #### Response Example ```json { "download": 94.5, "upload": 88.2, "ping": 15.3, "isp": "Example ISP", "server": { "name": "Example Server", "location": "City, Country", "country": "Country", "host": "example.server.com" } } ``` ``` -------------------------------- ### Search Ookla Servers using universal-speedtest (ESM) Source: https://karel-kryda.gitbook.io/universal-speedtest/tests Searches for Ookla test servers using a specified keyword and optionally limits the number of results. It requires the 'universal-speedtest' library and returns an array of server objects. ```javascript // This example shows the basic use of the search function. import { UniversalSpeedTest } from "universal-speedtest"; (async () => { // Search for test servers containing the specified keyword const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia"); console.log(testServers); // Search for test servers containing the specified keyword and limit the number of results to 15 const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.searchOoklaServers("czechia", 15); console.log(testServers); })(); ``` -------------------------------- ### Convert Speed Units (Mbps to MBps) using Universal Speedtest Source: https://karel-kryda.gitbook.io/universal-speedtest/utilities/unit-conversion Demonstrates converting download speed from Mbps to MBps using the `convertSpeedUnit` function from the universal-speedtest library. It first performs a speed test and then applies the conversion. ```esm // This example describes the conversion from Mbps to MBps. import { UniversalSpeedTest, SpeedUnits, convertSpeedUnit } from "universal-speedtest"; (async () => { // Run speedtest const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); const downloadSpeed = testResult.downloadResult.speed; // Convert speed to the new unit const newDownloadSpeed = convertSpeedUnit(SpeedUnits.Mbps, SpeedUnits.MBps, downloadSpeed); console.log(newDownloadSpeed); })(); ``` ```commonjs // This example describes the conversion from Mbps to MBps. const { UniversalSpeedTest, SpeedUnits, convertSpeedUnit } = require('universal-speedtest'); (async () => { // Run speedtest const universalSpeedTest = new UniversalSpeedTest(); const testResult = await universalSpeedTest.performOoklaTest(); const downloadSpeed = testResult.downloadResult.speed; // Convert speed to the new unit const newDownloadSpeed = convertSpeedUnit(SpeedUnits.Mbps, SpeedUnits.MBps, downloadSpeed); console.log(newDownloadSpeed); })(); ``` -------------------------------- ### Client Information API Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla/result/client Retrieves detailed information about the client's internet connection, including IP address, geolocation, and ISP performance metrics. ```APIDOC ## GET /client ### Description Provides information about you (the client), including your public IP address, location, and ISP details. ### Method GET ### Endpoint /client ### Parameters #### Query Parameters This endpoint does not accept query parameters. #### Request Body This endpoint does not accept a request body. ### Request Example ```none (No request body needed for GET request) ``` ### Response #### Success Response (200) - **ip** (string) - The public IP address of your internet connection - **lat** (number) - Your location's latitude - **lon** (number) - Your location's longitude - **isp** (string) - Name of your ISP - **isprating** (number) - Rating of your ISP - **ispdlavg** (number) - Average download speed for your ISP - **ispulavg** (number) - Average upload speed for your ISP - **country** (string) - Country code of the country you are in #### Response Example ```json { "ip": "192.0.2.1", "lat": 34.0522, "lon": -118.2437, "isp": "Example ISP", "isprating": 4.5, "ispdlavg": 100, "ispulavg": 50, "country": "US" } ``` ``` -------------------------------- ### uploadResult Parameter Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla/result/uploadresult Provides detailed information about the upload speed test results. ```APIDOC ## uploadResult ### Description Provides information about upload speed. This result parameter contains information about the upload test. ### Properties This is a list of all available test result parameters for the `uploadResult` parameter: - **transferredBytes** (number) - Number of bytes transferred during the test - **latency** (number) - Latency of your internet connection during the upload test - **jitter** (number) - Jitter of your internet connection during the upload test - **speed** (number) - The resulting upload speed, in the configured speed unit - **servers** (servers) - List of servers used for the upload test - **totalTime** (number) - Total time in seconds that the upload test took ``` -------------------------------- ### List Available Ookla Test Servers Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla Illustrates how to retrieve a list of available Ookla test servers. The function can optionally accept a number to limit the quantity of servers returned. This is useful for discovering nearby or specific servers for testing. ```esm // This example shows the basic use of the list function. import { UniversalSpeedTest } from "universal-speedtest"; (async () => { // List test servers const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.listOoklaServers(); console.log(testServers); // List test servers and limit the number of results to 15 const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.listOoklaServers(15); console.log(testServers); })(); ``` ```commonjs // This example shows the basic use of the list function. const { UniversalSpeedTest } = require('universal-speedtest'); (async () => { // List test servers const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.listOoklaServers(); console.log(testServers); // List test servers and limit the number of results to 15 const universalSpeedTest = new UniversalSpeedTest(); const testServers = await universalSpeedTest.listOoklaServers(15); console.log(testServers); })(); ``` -------------------------------- ### Download Result Properties Source: https://karel-kryda.gitbook.io/universal-speedtest/tests/ookla/result/downloadresult Provides information about the download speed test results. This includes details like transferred bytes, latency, jitter, speed, servers used, and the total duration of the test. ```APIDOC ## Download Result Properties ### Description Provides information about the download speed test results. This includes details like transferred bytes, latency, jitter, speed, servers used, and the total duration of the test. ### Method GET ### Endpoint /websites/karel-kryda_gitbook_io_universal-speedtest/downloadResult ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **transferredBytes** (number) - Number of bytes transferred during the test - **latency** (number) - Latency of your internet connection during the download test - **jitter** (number) - Jitter of your internet connection during the download test - **speed** (number) - The resulting download speed, in the configured speed unit - **servers** (servers) - List of servers used for the download test - **totalTime** (number) - Total time in seconds that the download test took #### Response Example ```json { "transferredBytes": 1000000, "latency": 25, "jitter": 2, "speed": 80, "servers": [ { "address": "1.2.3.4:8080", "latency": 20, "jitter": 1, "download": 85, "upload": 90, "country": "US", "sponsor": "Test Provider" } ], "totalTime": 10 } ``` ``` -------------------------------- ### Perform Ookla Speedtest Source: https://karel-kryda.gitbook.io/universal-speedtest/tests This endpoint performs a basic internet speed test using Ookla servers. It returns the test results including download, upload speeds, and latency. ```APIDOC ## POST /performOoklaTest ### Description Performs a basic internet speed test using Ookla servers. ### Method POST ### Endpoint /performOoklaTest ### Parameters #### Request Body - **server** (object) - Optional - The specific Ookla server object to use for the test. If not provided, a default server will be selected. ### Request Example ```json { "server": { "id": 1234, "url": "http://example.com/speedtest", "lat": "40.7128", "lon": "-74.0060", "name": "New York", "country": "USA", "cc": "US", "sponsor": "Example Sponsor", "distance": 100, "latency": 50 } } ``` ### Response #### Success Response (200) - **download** (number) - Download speed in Mbps. - **upload** (number) - Upload speed in Mbps. - **ping** (number) - Latency in milliseconds. - **server** (object) - Information about the server used for the test. #### Response Example ```json { "download": 94.5, "upload": 88.2, "ping": 25, "server": { "id": 1234, "url": "http://example.com/speedtest", "lat": "40.7128", "lon": "-74.0060", "name": "New York", "country": "USA", "cc": "US", "sponsor": "Example Sponsor", "distance": 100, "latency": 50 } } ``` ``` -------------------------------- ### Units Configuration API Source: https://karel-kryda.gitbook.io/universal-speedtest/general/configuration/options/units Configures the units for reporting speedtest results, including distance, download speed, and upload speed. ```APIDOC ## GET /websites/karel-kryda_gitbook_io_universal-speedtest/units ### Description Retrieves the current configuration for result units. ### Method GET ### Endpoint /websites/karel-kryda_gitbook_io_universal-speedtest/units ### Parameters None ### Request Example None ### Response #### Success Response (200) - **distanceUnit** (DistanceUnits) - The unit for reporting distance. - **downloadUnit** (SpeedUnits) - The unit for reporting download speed. - **uploadUnit** (SpeedUnits) - The unit for reporting upload speed. #### Response Example ```json { "distanceUnit": "mi", "downloadUnit": "Mbps", "uploadUnit": "Mbps" } ``` ## PUT /websites/karel-kryda_gitbook_io_universal-speedtest/units ### Description Configures the units for reporting speedtest results, including distance, download speed, and upload speed. ### Method PUT ### Endpoint /websites/karel-kryda_gitbook_io_universal-speedtest/units ### Parameters None #### Request Body - **distanceUnit** (DistanceUnits) - Required - Sets in which unit the distance of the test servers will be reported. Defaults to `DistanceUnits.mi`. - **downloadUnit** (SpeedUnits) - Required - Sets in which unit the download speed will be reported. Defaults to `SpeedUnits.Mbps`. - **uploadUnit** (SpeedUnits) - Required - Sets in which unit the upload speed will be reported. Defaults to `SpeedUnits.Mbps`. ### Request Example ```json { "distanceUnit": "km", "downloadUnit": "Gbps", "uploadUnit": "Gbps" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating successful configuration. #### Response Example ```json { "message": "Units configured successfully." } ``` ``` -------------------------------- ### Configure Result Units - Universal Speedtest Source: https://karel-kryda.gitbook.io/universal-speedtest/general/configuration/options/units This section describes how to configure the units for results in Universal Speedtest. It outlines options for distance units, download speed units, and upload speed units, specifying their types and default values. ```typescript distanceUnit: DistanceUnits; // Default: DistanceUnits.mi // Sets in which unit the distance of the test servers will be reported downloadUnit: SpeedUnits; // Default: SpeedUnits.Mbps // Sets in which unit the download speed will be reported uploadUnit: SpeedUnits; // Default: SpeedUnits.Mbps // Sets in which unit the upload speed will be reported ``` -------------------------------- ### Configure Tests: Measure Download Speed Source: https://karel-kryda.gitbook.io/universal-speedtest/general/configuration/options/tests This setting enables or disables the download speed measurement. It is a boolean type and defaults to true, meaning download speed is measured by default. ```configuration measureDownload: true ``` -------------------------------- ### SpeedUnits Enum Definition Source: https://karel-kryda.gitbook.io/universal-speedtest/general/configuration/enums/speedunits Defines an enumeration for various speed units used in speed testing. This includes byte-based units (Bps, KBps, MBps, GBps) and bit-based units (bps, Kbps, Mbps, Gbps). ```typescript export enum SpeedUnits { Bps = "Bps", KBps = "KBps", MBps = "MBps", GBps = "GBps", bps = "bps", Kbps = "Kbps", Mbps = "Mbps", Gbps = "Gbps" } ``` -------------------------------- ### Configure Tests: Measure Upload Speed Source: https://karel-kryda.gitbook.io/universal-speedtest/general/configuration/options/tests This setting enables or disables the upload speed measurement. It is a boolean type and defaults to false, meaning upload speed is not measured by default. ```configuration measureUpload: false ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.