/window

GET SYNC

Opens a URL in the default system browser.

GET /api/v1/window
Alias: /open-url-in-browser

Description

This utility endpoint triggers a command on the host operating system to open the provided URL in the default external web browser. It's designed to allow the web-based UI of a desktop application to open external links.

Query Parameters

ParameterTypeRequiredDescription
url string Yes The full, URL-encoded URL to be opened (e.g., https%3A%2F%2Fcloudcoin.global).

Response

Returns a 200 OK with the string "OK" if the command was issued successfully.

Examples

JavaScript Example

const apiHost = 'http://localhost:8006';
const externalUrl = 'https://cloudcoin.global';

// URL-encode the parameter for safety
const encodedUrl = encodeURIComponent(externalUrl);

fetch(`${apiHost}/api/v1/window?url=${encodedUrl}`)
    .then(response => {
        if (response.ok) {
            console.log('Command to open URL was sent successfully.');
        } else {
            console.error('Failed to send open URL command.');
        }
    })
    .catch(error => console.error('Error:', error));

cURL Example

# Note: The shell may try to interpret '&'. It's best to quote the URL.
curl -X GET "http://localhost:8006/api/v1/window?url=https%3A%2F%2Fcloudcoin.global"