/info

GET SYNC

Provides status and version information about the application.

GET /api/v1/info
Alias: /get-system-information

Description

Retrieves key status and version information about the running application. It checks for new versions online, reports any fatal errors, indicates the current operational mode, and provides the default download folder path. This is a synchronous call.

Synchronous Call

This is a synchronous API call. It fetches the information and returns it directly in the response.

Request

This endpoint requires no URL parameters or request body.

Response

Returns a `200 OK` response with a JSON object containing the application's information.

Response Properties

version string
The current version of the running application.
latest_version string
The latest version available for download, fetched from a remote server.
upgrade_available boolean
True if a newer version of the application is available.
fatal_error string
Contains an error message if the application is in a fatal error state. Otherwise, it is an empty string.
is_serial_mode boolean
Indicates if the application is operating in serial mode.
is_http_mode boolean
Indicates if the application is operating in HTTP mode.
download_folder string
The default folder path for file downloads, typically the user's Desktop.

Example Response

{
    "version": "1.0.0",
    "latest_version": "1.1.0",
    "upgrade_available": true,
    "fatal_error": "",
    "is_serial_mode": false,
    "is_http_mode": true,
    "download_folder": "/Users/user/Desktop"
}

Examples

JavaScript Example

async function getAppInfo() {
    try {
        const response = await fetch('http://localhost:8006/api/v1/info');
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        const info = await response.json();

        console.log(`Application Version: ${info.version}`);
        if (info.upgrade_available) {
            console.log(`A new version is available: ${info.latest_version}`);
        } else {
            console.log('You are running the latest version.');
        }

        if (info.fatal_error) {
            console.error(`A fatal error has occurred: ${info.fatal_error}`);
        }
    } catch (error) {
        console.error('Error fetching info:', error);
    }
}

cURL Example

# Make a GET request to the info endpoint
curl -X GET "http://localhost:8006/api/v1/info"

# Example response:
# {"version":"1.0.0","latest_version":"1.1.0","upgrade_available":true,"fatal_error":"","is_serial_mode":false,"is_http_mode":true,"download_folder":"/Users/user/Desktop"}

Go Example

package main

import (
	"encoding/json"
	"fmt"
	"net/http"
)

type InfoResponse struct {
	Version          string `json:"version"`
	LatestVersion    string `json:"latest_version"`
	UpgradeAvailable bool   `json:"upgrade_available"`
	FatalError       string `json:"fatal_error"`
	DownloadFolder   string `json:"download_folder"`
}

func getAppInfo() {
	resp, err := http.Get("http://localhost:8006/api/v1/info")
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	var info InfoResponse
	if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
		panic(err)
	}

	fmt.Printf("Version: %s\n", info.Version)
	if info.UpgradeAvailable {
		fmt.Printf("Upgrade to %s is available.\n", info.LatestVersion)
	} else {
		fmt.Println("Application is up to date.")
	}
}