From a419d623a16cf92a86778e9d62069b186a5cb417 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 12 Apr 2025 14:54:53 +0000 Subject: [PATCH] Rework --- CONTRIBUTING.md | 2 +- app/build.gradle | 7 - .../io/xpipe/app/prefs/AboutCategory.java | 2 +- .../xpipe/app/terminal/TerminalLauncher.java | 1 + .../terminal/TerminalMultiplexerManager.java | 30 + .../io/xpipe/app/terminal/TerminalView.java | 14 +- .../app/terminal/TmuxTerminalMultiplexer.java | 2 +- .../terminal/ZellijTerminalMultiplexer.java | 4 +- .../java/io/xpipe/app/util/Hyperlinks.java | 3 - .../io/xpipe/app/resources/misc/api.md | 3920 ----------------- beacon/README.md | 2 +- .../ext/base/action/RunScriptActionMenu.java | 5 - openapi.yaml | 1140 ----- 13 files changed, 47 insertions(+), 5085 deletions(-) delete mode 100644 app/src/main/resources/io/xpipe/app/resources/misc/api.md delete mode 100644 openapi.yaml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a31a3b241..f7e5097f3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,7 +75,7 @@ Especially when starting out, it might be a good idea to start with easy tasks f ### Interacting via the HTTP API You can create clients that communicate with the XPipe daemon via its HTTP API. -To get started, see the [OpenAPI spec](/openapi.yaml). +To get started, see the [OpenAPI spec](https://docs.xpipe.io/api). ### Implementing support for a new editor diff --git a/app/build.gradle b/app/build.gradle index 2b35c1a5e..9d9090cd6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -156,13 +156,6 @@ processResources { into resourcesDir } } - - doLast { - copy { - from file("$rootDir/openapi.yaml") - into file("${sourceSets.main.output.resourcesDir}/io/xpipe/app/resources/misc"); - } - } } distTar { diff --git a/app/src/main/java/io/xpipe/app/prefs/AboutCategory.java b/app/src/main/java/io/xpipe/app/prefs/AboutCategory.java index 17e87b82c..284b26f3e 100644 --- a/app/src/main/java/io/xpipe/app/prefs/AboutCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/AboutCategory.java @@ -31,7 +31,7 @@ public class AboutCategory extends AppPrefsCategory { @Override protected Comp create() { var props = createProperties().padding(new Insets(0, 0, 0, 5)); - var update = new UpdateCheckComp().grow(true, false); + var update = new UpdateCheckComp().grow(true, false).prefWidth(600); return new VerticalComp(List.of(props, Comp.hspacer(8), update, Comp.hspacer(13), Comp.hseparator().padding(Insets.EMPTY))) .apply(s -> s.get().setFillWidth(true)) .apply(struc -> struc.get().setSpacing(15)) diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java b/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java index 230662f60..a307fadbd 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java @@ -175,6 +175,7 @@ public class TerminalLauncher { if (preferTabs) { var multiplexerConfig = launchMultiplexerTabInNewTerminal(request, terminalConfig, config); if (multiplexerConfig.isPresent()) { + TerminalMultiplexerManager.registerMultiplexerLaunch(request); launch(type, multiplexerConfig.get(), latch); return; } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalMultiplexerManager.java b/app/src/main/java/io/xpipe/app/terminal/TerminalMultiplexerManager.java index 908b219ba..0f2adc1e4 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalMultiplexerManager.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalMultiplexerManager.java @@ -1,19 +1,49 @@ package io.xpipe.app.terminal; import io.xpipe.app.prefs.AppPrefs; +import io.xpipe.app.util.ThreadHelper; import java.util.*; public class TerminalMultiplexerManager { + private static UUID pendingMultiplexerLaunch; private static final Map connectionHubRequests = new HashMap<>(); + public static void registerMultiplexerLaunch(UUID uuid) { + pendingMultiplexerLaunch = uuid; + var listener = new TerminalView.Listener() { + @Override + public void onSessionOpened(TerminalView.ShellSession session) { + if (session.getRequest().equals(pendingMultiplexerLaunch)) { + pendingMultiplexerLaunch = null; + TerminalView.get().removeListener(this); + } + } + }; + TerminalView.get().addListener(listener); + } + public static Optional getEffectiveMultiplexer() { var multiplexer = AppPrefs.get().terminalMultiplexer().getValue(); return Optional.ofNullable(multiplexer); } public static boolean requiresNewTerminalSession(UUID requestUuid) { + // Wait if we are currently opening a new multiplexer + if (pendingMultiplexerLaunch != null) { + // Wait for max 10s + for (int i = 0; i < 100; i++) { + if (pendingMultiplexerLaunch == null) { + break; + } + + ThreadHelper.sleep(100); + } + // Give multiplexer a second to start in terminal + ThreadHelper.sleep(1000); + } + var mult = getEffectiveMultiplexer(); if (mult.isEmpty()) { connectionHubRequests.put(requestUuid, null); diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalView.java b/app/src/main/java/io/xpipe/app/terminal/TerminalView.java index 85fc0d317..b2e5960ed 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalView.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalView.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; +import java.util.function.Consumer; public class TerminalView { @@ -106,18 +107,23 @@ public class TerminalView { if (!terminalInstances.contains(tv.get())) { terminalInstances.add(tv.get()); - listeners.forEach(listener -> listener.onTerminalOpened(tv.get())); + forListeners(listener -> listener.onTerminalOpened(tv.get())); } var session = new ShellSession(request, shell.get(), tv.get()); sessions.add(session); - listeners.forEach(listener -> listener.onSessionOpened(session)); + forListeners(listener -> listener.onSessionOpened(session)); TrackEvent.withTrace("Terminal instance opened") .tag("terminalPid", terminal.get().pid()) .handle(); } + private void forListeners(Consumer consumer) { + var copy = new ArrayList<>(listeners); + copy.forEach(consumer); + } + private Optional createTerminalSession(ProcessHandle terminalProcess) { return switch (OsType.getLocal()) { case OsType.Linux linux -> Optional.of(new TerminalSession(terminalProcess)); @@ -179,7 +185,7 @@ public class TerminalView { var alive = session.shell.isAlive() && session.getTerminal().isRunning(); if (!alive) { sessions.remove(session); - listeners.forEach(listener -> listener.onSessionClosed(session)); + forListeners(listener -> listener.onSessionClosed(session)); } } @@ -190,7 +196,7 @@ public class TerminalView { TrackEvent.withTrace("Terminal session is dead") .tag("pid", terminalInstance.getTerminalProcess().pid()) .handle(); - listeners.forEach(listener -> listener.onTerminalClosed(terminalInstance)); + forListeners(listener -> listener.onTerminalClosed(terminalInstance)); } } } diff --git a/app/src/main/java/io/xpipe/app/terminal/TmuxTerminalMultiplexer.java b/app/src/main/java/io/xpipe/app/terminal/TmuxTerminalMultiplexer.java index 4d11ec88f..199885fba 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TmuxTerminalMultiplexer.java +++ b/app/src/main/java/io/xpipe/app/terminal/TmuxTerminalMultiplexer.java @@ -38,7 +38,7 @@ public class TmuxTerminalMultiplexer implements TerminalMultiplexer { "tmux kill-session -t xpipe", "tmux new-session -d -s xpipe", "tmux rename-window \"" + escape(config.getDisplayName(), true) + "\"", - "tmux send-keys -t xpipe '" + escape(command, false) + ";exit' Enter", + "tmux send-keys -t xpipe ' " + escape(command, false) + "; exit' Enter", "tmux attach -d -t xpipe"); } diff --git a/app/src/main/java/io/xpipe/app/terminal/ZellijTerminalMultiplexer.java b/app/src/main/java/io/xpipe/app/terminal/ZellijTerminalMultiplexer.java index 9dfc99875..6c99f6f86 100644 --- a/app/src/main/java/io/xpipe/app/terminal/ZellijTerminalMultiplexer.java +++ b/app/src/main/java/io/xpipe/app/terminal/ZellijTerminalMultiplexer.java @@ -30,7 +30,7 @@ public class ZellijTerminalMultiplexer implements TerminalMultiplexer { return ShellScript.lines( "zellij attach --create-background xpipe", "zellij -s xpipe action new-tab --name \"" + escape(config.getDisplayName(), false, true) + "\"", - "zellij -s xpipe action write-chars -- " + escape(command, true, true) + "\\;exit", + "zellij -s xpipe action write-chars -- " + escape(" " + command, true, true) + "\\;exit", "zellij -s xpipe action write 10", "zellij -s xpipe action clear" ); @@ -43,7 +43,7 @@ public class ZellijTerminalMultiplexer implements TerminalMultiplexer { "zellij delete-session -f xpipe > /dev/null 2>&1", "zellij attach --create-background xpipe", "zellij -s xpipe run -c --name \"" + escape(config.getDisplayName(), false, true) + "\" -- " - + escape(command, false, false), + + escape(" " + command, false, false), "zellij attach xpipe"); } diff --git a/app/src/main/java/io/xpipe/app/util/Hyperlinks.java b/app/src/main/java/io/xpipe/app/util/Hyperlinks.java index 0ecc9de3e..d985510a2 100644 --- a/app/src/main/java/io/xpipe/app/util/Hyperlinks.java +++ b/app/src/main/java/io/xpipe/app/util/Hyperlinks.java @@ -6,12 +6,9 @@ public class Hyperlinks { public static final String GITHUB = "https://github.com/xpipe-io/xpipe"; public static final String GITHUB_PTB = "https://github.com/xpipe-io/xpipe-ptb"; public static final String GITHUB_LATEST = "https://github.com/xpipe-io/xpipe/releases/latest"; - public static final String GITHUB_PYTHON_API = "https://github.com/xpipe-io/xpipe-python-api"; public static final String TRANSLATE = "https://github.com/xpipe-io/xpipe/tree/master/lang"; public static final String DISCORD = "https://discord.gg/8y89vS8cRb"; public static final String GITHUB_WEBTOP = "https://github.com/xpipe-io/xpipe-webtop"; - public static final String SLACK = - "https://join.slack.com/t/XPipe/shared_invite/zt-1awjq0t5j-5i4UjNJfNe1VN4b_auu6Cg"; public static void open(String uri) { DesktopHelper.openUrl(uri); diff --git a/app/src/main/resources/io/xpipe/app/resources/misc/api.md b/app/src/main/resources/io/xpipe/app/resources/misc/api.md deleted file mode 100644 index 35a04ee67..000000000 --- a/app/src/main/resources/io/xpipe/app/resources/misc/api.md +++ /dev/null @@ -1,3920 +0,0 @@ ---- -title: XPipe API Documentation v14.0 -language_tabs: - - javascript: JavaScript - - python: Python - - java: Java - - go: Go - - shell: Shell -language_clients: - - javascript: "" - - python: "" - - java: "" - - go: "" - - shell: "" -toc_footers: - - XPipe - Plans and pricing -includes: [] -search: true -highlight_theme: darkula -headingLevel: 2 - ---- - -

XPipe API Documentation v14.0

- -The XPipe API provides programmatic access to XPipe’s features. -You can get started by either using this page as an API reference or alternatively import the OpenAPI definition file into your API client of choice: - -OpenAPI .yaml specification - -The XPipe application will start up an HTTP server that can be used to send requests. -Note that this server is HTTP-only for now as it runs only on localhost. HTTPS requests are not accepted. - -You can either call the API directly or using the official [XPipe Python API](https://github.com/xpipe-io/xpipe-python-api). - -To start off with the API, you can query connections based on various filters. -With the matched connections, you can start remote shell sessions for each one and run arbitrary commands in them. -You get the command exit code and output as a response, allowing you to adapt your control flow based on command outputs. -Any kind of passwords and other secrets are automatically provided by XPipe when establishing a shell connection. -If a required password is not stored and is set to be dynamically prompted, the running XPipe application will ask you to enter any required passwords. - -See the authentication handshake below on how to authenticate prior to sending requests. -For development, you can also skip the authentication step by disabling it in the settings menu. - -Base URLs: - -* http://localhost:21721 - -Table of contents: -[TOC] - -# Authentication - -- HTTP Authentication, scheme: bearer The bearer token used is the session token that you receive from the handshake exchange. - -

Default

- -## Establish a new API session - - - -`POST /handshake` - -Prior to sending requests to the API, you first have to establish a new API session via the handshake endpoint. -In the response you will receive a session token that you can use to authenticate during this session. - -This is done so that the daemon knows what kind of clients are connected and can manage individual capabilities for clients. -If your client is running on the same system as the daemon, you can choose the local authentication method to avoid having to deal with API keys. -If your client does not have file system access, e.g. if it is running remotely, then you have to use an API key. - -Note that for development you can also turn off the required authentication in the XPipe settings menu, allowing you to send unauthenticated requests. - -> Body parameter - -```json -{ - "auth": { - "type": "ApiKey", - "key": "" - }, - "client": { - "type": "Api", - "name": "My client name" - } -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[HandshakeRequest](#schemahandshakerequest)|true|none| - -> Example responses - -> 200 Response - -```json -{ - "sessionToken": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The handshake was successful. The returned token can be used for authentication in this session. The token is valid as long as XPipe is running.|[HandshakeResponse](#schemahandshakeresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "auth": { - "type": "ApiKey", - "key": "" - }, - "client": { - "type": "Api", - "name": "My client name" - } -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json' -}; - -fetch('http://localhost:21721/handshake', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json' -} - -data = """ -{ - "auth": { - "type": "ApiKey", - "key": "" - }, - "client": { - "type": "Api", - "name": "My client name" - } -} -""" -r = requests.post('http://localhost:21721/handshake', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/handshake"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "auth": { - "type": "ApiKey", - "key": "" - }, - "client": { - "type": "Api", - "name": "My client name" - } -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/handshake", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/handshake \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ - --data ' -{ - "auth": { - "type": "ApiKey", - "key": "" - }, - "client": { - "type": "Api", - "name": "My client name" - } -} -' - -``` - -
- -## Query connections - - - -`POST /connection/query` - -Queries all connections using various filters. - -The filters support globs and can match the category names and connection names. -All matching is case insensitive. - -> Body parameter - -```json -{ - "categoryFilter": "*", - "connectionFilter": "*", - "typeFilter": "*" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionQueryRequest](#schemaconnectionqueryrequest)|true|none| - -> Example responses - -> The query was successful. The body contains all matched connections. - -```json -{ - "found": [ - "f0ec68aa-63f5-405c-b178-9a4454556d6b" - ] -} -``` - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The query was successful. The body contains all matched connections.|[ConnectionQueryResponse](#schemaconnectionqueryresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "categoryFilter": "*", - "connectionFilter": "*", - "typeFilter": "*" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/query', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "categoryFilter": "*", - "connectionFilter": "*", - "typeFilter": "*" -} -""" -r = requests.post('http://localhost:21721/connection/query', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/query"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "categoryFilter": "*", - "connectionFilter": "*", - "typeFilter": "*" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/query", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/query \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "categoryFilter": "*", - "connectionFilter": "*", - "typeFilter": "*" -} -' - -``` - -
- -## Connection information - - - -`POST /connection/info` - -Queries detailed information about a connection. - -> Body parameter - -```json -{ - "connections": [ - "f0ec68aa-63f5-405c-b178-9a4454556d6b" - ] -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionInfoRequest](#schemaconnectioninforequest)|true|none| - -> Example responses - -> The query was successful. The body contains the detailed connection information. - -```json -{ - "infos": [ - { - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "category": [ - "default" - ], - "name": [ - "local machine" - ], - "type": "local", - "rawData": {}, - "usageCategory": "shell", - "lastUsed": "2024-05-31T11:53:02.408504600Z", - "lastModified": "2024-06-23T21:15:25.608097Z", - "state": {} - } - ] -} -``` - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The query was successful. The body contains the detailed connection information.|[ConnectionInfoResponse](#schemaconnectioninforesponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connections": [ - "f0ec68aa-63f5-405c-b178-9a4454556d6b" - ] -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/info', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connections": [ - "f0ec68aa-63f5-405c-b178-9a4454556d6b" - ] -} -""" -r = requests.post('http://localhost:21721/connection/info', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/info"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connections": [ - "f0ec68aa-63f5-405c-b178-9a4454556d6b" - ] -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/info", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/info \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connections": [ - "f0ec68aa-63f5-405c-b178-9a4454556d6b" - ] -} -' - -``` - -
- -## Add new connection - - - -`POST /connection/add` - -Creates the new connection in the xpipe vault from raw json data. -This can also perform an optional validation first to make sure that the connection can be established. - -If an equivalent connection already exists, no new one will be added. - -> Body parameter - -```json -{ - "name": "my connection", - "validate": true, - "category": "97458c07-75c0-4f9d-a06e-92d8cdf67c40", - "data": { - "type": "shellEnvironment", - "commands": null, - "host": { - "storeId": "f0ec68aa-63f5-405c-b178-9a4454556d6b" - }, - "shell": "pwsh", - "elevated": false - } -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionAddRequest](#schemaconnectionaddrequest)|true|none| - -> Example responses - -> The request was successful. The connection was added. - -```json -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c" -} -``` - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The request was successful. The connection was added.|[ConnectionAddResponse](#schemaconnectionaddresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "name": "my connection", - "validate": true, - "category": "97458c07-75c0-4f9d-a06e-92d8cdf67c40", - "data": { - "type": "shellEnvironment", - "commands": null, - "host": { - "storeId": "f0ec68aa-63f5-405c-b178-9a4454556d6b" - }, - "shell": "pwsh", - "elevated": false - } -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/add', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "name": "my connection", - "validate": true, - "category": "97458c07-75c0-4f9d-a06e-92d8cdf67c40", - "data": { - "type": "shellEnvironment", - "commands": null, - "host": { - "storeId": "f0ec68aa-63f5-405c-b178-9a4454556d6b" - }, - "shell": "pwsh", - "elevated": false - } -} -""" -r = requests.post('http://localhost:21721/connection/add', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/add"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "name": "my connection", - "validate": true, - "category": "97458c07-75c0-4f9d-a06e-92d8cdf67c40", - "data": { - "type": "shellEnvironment", - "commands": null, - "host": { - "storeId": "f0ec68aa-63f5-405c-b178-9a4454556d6b" - }, - "shell": "pwsh", - "elevated": false - } -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/add", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/add \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "name": "my connection", - "validate": true, - "category": "97458c07-75c0-4f9d-a06e-92d8cdf67c40", - "data": { - "type": "shellEnvironment", - "commands": null, - "host": { - "storeId": "f0ec68aa-63f5-405c-b178-9a4454556d6b" - }, - "shell": "pwsh", - "elevated": false - } -} -' - -``` - -
- -## Add new category - - - -`POST /category/add` - -Creates a new empty category in the vault. - -New categories always need a parent as it's not allowed to create root categories. - -> Body parameter - -```json -{ - "name": "my category", - "parent": "97458c07-75c0-4f9d-a06e-92d8cdf67c40" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[CategoryAddRequest](#schemacategoryaddrequest)|true|none| - -> Example responses - -> The request was successful. The category was added. - -```json -{ - "category": "36ad9716-a209-4f7f-9814-078d3349280c" -} -``` - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The request was successful. The category was added.|[CategoryAddResponse](#schemacategoryaddresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "name": "my category", - "parent": "97458c07-75c0-4f9d-a06e-92d8cdf67c40" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/category/add', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "name": "my category", - "parent": "97458c07-75c0-4f9d-a06e-92d8cdf67c40" -} -""" -r = requests.post('http://localhost:21721/category/add', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/category/add"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "name": "my category", - "parent": "97458c07-75c0-4f9d-a06e-92d8cdf67c40" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/category/add", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/category/add \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "name": "my category", - "parent": "97458c07-75c0-4f9d-a06e-92d8cdf67c40" -} -' - -``` - -
- -## Remove connection - - - -`POST /connection/remove` - -Removes a set of connection. This includes any possible children associated with the connection. - -Some connections, for example the local machine, can not be removed. - -> Body parameter - -```json -{ - "connections": [ - "36ad9716-a209-4f7f-9814-078d3349280c" - ] -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionRemoveRequest](#schemaconnectionremoverequest)|true|none| - -> Example responses - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The removal was successful.|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connections": [ - "36ad9716-a209-4f7f-9814-078d3349280c" - ] -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/remove', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connections": [ - "36ad9716-a209-4f7f-9814-078d3349280c" - ] -} -""" -r = requests.post('http://localhost:21721/connection/remove', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/remove"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connections": [ - "36ad9716-a209-4f7f-9814-078d3349280c" - ] -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/remove", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/remove \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connections": [ - "36ad9716-a209-4f7f-9814-078d3349280c" - ] -} -' - -``` - -
- -## Open connection in file browser - - - -`POST /connection/browse` - -Creates a new tab in the file browser and opens the specified connections with an optional starting directory. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionBrowseRequest](#schemaconnectionbrowserequest)|true|none| - -> Example responses - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The request was successful. The connection was opened.|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/browse', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -""" -r = requests.post('http://localhost:21721/connection/browse', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/browse"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/browse", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/browse \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -' - -``` - -
- -## Open terminal for shell connection - - - -`POST /connection/terminal` - -Launches a new terminal session for a connection with an optional specified working directory. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionTerminalRequest](#schemaconnectionterminalrequest)|true|none| - -> Example responses - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The request was successful. The connection was opened.|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/terminal', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -""" -r = requests.post('http://localhost:21721/connection/terminal', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/terminal"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/terminal", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/terminal \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -' - -``` - -
- -## Toggle state of a connection - - - -`POST /connection/toggle` - -Updates the state of a connection to either start or stop a session. - -This can be used for all kinds of services and tunnels. - -> Body parameter - -```json -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c", - "state": true -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionToggleRequest](#schemaconnectiontogglerequest)|true|none| - -> Example responses - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The request was successful. The connection state was updated.|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c", - "state": true -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/toggle', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c", - "state": true -} -""" -r = requests.post('http://localhost:21721/connection/toggle', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/toggle"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c", - "state": true -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/toggle", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/toggle \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c", - "state": true -} -' - -``` - -
- -## Refresh state of a connection - - - -`POST /connection/refresh` - -Performs a refresh on the specified connection. - -This will update the connection state information and also any children if the connection type has any. - -> Body parameter - -```json -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ConnectionRefreshRequest](#schemaconnectionrefreshrequest)|true|none| - -> Example responses - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The request was successful. The connection state was updated.|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/connection/refresh', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c" -} -""" -r = requests.post('http://localhost:21721/connection/refresh', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/connection/refresh"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/connection/refresh", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/connection/refresh \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "36ad9716-a209-4f7f-9814-078d3349280c" -} -' - -``` - -
- -## Start shell connection - - - -`POST /shell/start` - -Starts a new shell session for a connection. If an existing shell session is already running for that connection, this operation will do nothing. - -Note that there are a variety of possible errors that can occur here when establishing the shell connection. -These errors will be returned with the HTTP return code 500. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ShellStartRequest](#schemashellstartrequest)|true|none| - -> Example responses - -> 200 Response - -```json -{ - "shellDialect": 0, - "osType": "string", - "osName": "string", - "ttyState": "string", - "temp": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful. The shell session was started.|[ShellStartResponse](#schemashellstartresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/shell/start', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -""" -r = requests.post('http://localhost:21721/shell/start', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/shell/start"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/shell/start", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/shell/start \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -' - -``` - -
- -## Stop shell connection - - - -`POST /shell/stop` - -Stops an existing shell session for a connection. - -This operation will return once the shell has exited. -If the shell is busy or stuck, you might have to work with timeouts to account for these cases. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ShellStopRequest](#schemashellstoprequest)|true|none| - -> Example responses - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful. The shell session was stopped.|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/shell/stop', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -""" -r = requests.post('http://localhost:21721/shell/stop', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/shell/stop"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/shell/stop", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/shell/stop \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" -} -' - -``` - -
- -## Execute command in a shell session - - - -`POST /shell/exec` - -Runs a command in an active shell session and waits for it to finish. The exit code and output will be returned in the response. - -Note that a variety of different errors can occur when executing the command. -If the command finishes, even with an error code, a normal HTTP 200 response will be returned. -However, if any other error occurs like the shell not responding or exiting unexpectedly, an HTTP 500 response will be returned. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "command": "echo $USER" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[ShellExecRequest](#schemashellexecrequest)|true|none| - -> Example responses - -> The operation was successful. The shell command finished. - -```json -{ - "exitCode": 0, - "stdout": "root", - "stderr": "" -} -``` - -```json -{ - "exitCode": 127, - "stdout": "", - "stderr": "invalid: command not found" -} -``` - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful. The shell command finished.|[ShellExecResponse](#schemashellexecresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "command": "echo $USER" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/shell/exec', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "command": "echo $USER" -} -""" -r = requests.post('http://localhost:21721/shell/exec', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/shell/exec"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "command": "echo $USER" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/shell/exec", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/shell/exec \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "command": "echo $USER" -} -' - -``` - -
- -## Store a raw blob to be used later - - - -`POST /fs/blob` - -Stores arbitrary binary data in a blob such that it can be used later on to for example write to a remote file. - -This will return a uuid which can be used as a reference to the blob. -You can also store normal text data in blobs if you intend to create text or shell script files with it. - -> Body parameter - -```yaml -string - -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|string(binary)|true|none| - -> Example responses - -> The operation was successful. The data was stored. - -```json -{ - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" -} -``` - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful. The data was stored.|[FsBlobResponse](#schemafsblobresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = 'string'; -const headers = { - 'Content-Type':'application/octet-stream', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/fs/blob', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/octet-stream', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -string -""" -r = requests.post('http://localhost:21721/fs/blob', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/fs/blob"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/octet-stream") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -string - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/octet-stream"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/fs/blob", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/fs/blob \ - -H 'Content-Type: application/octet-stream' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -string -' - -``` - -
- -## Read the content of a remote file - - - -`POST /fs/read` - -Reads the entire content of a remote file through an active shell session. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "path": "/home/user/myfile.txt" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[FsReadRequest](#schemafsreadrequest)|true|none| - -> Example responses - -> 200 Response - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful. The file was read.|string| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "path": "/home/user/myfile.txt" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/octet-stream', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/fs/read', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/octet-stream', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "path": "/home/user/myfile.txt" -} -""" -r = requests.post('http://localhost:21721/fs/read', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/fs/read"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/octet-stream") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "path": "/home/user/myfile.txt" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/octet-stream"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/fs/read", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/fs/read \ - -H 'Content-Type: application/json' \ -H 'Accept: application/octet-stream' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "path": "/home/user/myfile.txt" -} -' - -``` - -
- -## Write a blob to a remote file - - - -`POST /fs/write` - -Writes blob data to a file through an active shell session. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304", - "path": "/home/user/myfile.txt" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[FsWriteRequest](#schemafswriterequest)|true|none| - -> Example responses - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful. The file was written.|None| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304", - "path": "/home/user/myfile.txt" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/fs/write', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304", - "path": "/home/user/myfile.txt" -} -""" -r = requests.post('http://localhost:21721/fs/write', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/fs/write"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304", - "path": "/home/user/myfile.txt" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/fs/write", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/fs/write \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304", - "path": "/home/user/myfile.txt" -} -' - -``` - -
- -## Create a shell script file from a blob - - - -`POST /fs/script` - -Creates a shell script in the temporary directory of the file system that is access through the shell connection. - -This can be used to run more complex commands on remote systems. - -> Body parameter - -```json -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" -} -``` - -

Parameters

- -|Name|In|Type|Required|Description| -|---|---|---|---|---| -|body|body|[FsScriptRequest](#schemafsscriptrequest)|true|none| - -> Example responses - -> The operation was successful. The script file was created. - -```json -{ - "path": "/tmp/xpipe-123.sh" -} -``` - -> 400 Response - -```json -{ - "message": "string" -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful. The script file was created.|[FsScriptResponse](#schemafsscriptresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript -const inputBody = '{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" -}'; -const headers = { - 'Content-Type':'application/json', - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/fs/script', -{ - method: 'POST', - body: inputBody, - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" -} -""" -r = requests.post('http://localhost:21721/fs/script', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/fs/script"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Content-Type", "application/json") - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" -} - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Content-Type": []string{"application/json"}, - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/fs/script", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/fs/script \ - -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -{ - "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", - "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" -} -' - -``` - -
- -## Query daemon version - - - -`POST /daemon/version` - -Retrieves version information from the daemon - -> Example responses - -> 200 Response - -```json -{ - "version": "string", - "canonicalVersion": "string", - "buildVersion": "string", - "jvmVersion": "string", - "pro": true -} -``` - -

Responses

- -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The operation was successful|[DaemonVersionResponse](#schemadaemonversionresponse)| -|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad request. Please check error message and your parameters.|[ClientErrorResponse](#schemaclienterrorresponse)| -|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Authorization failed. Please supply a `Bearer` token via the `Authorization` header.|None| -|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.|None| -|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal error.|[ServerErrorResponse](#schemaservererrorresponse)| - - - -
- -Code samples - -```javascript - -const headers = { - 'Accept':'application/json', - 'Authorization':'Bearer {access-token}' -}; - -fetch('http://localhost:21721/daemon/version', -{ - method: 'POST', - - headers: headers -}) -.then(function(res) { - return res.json(); -}).then(function(body) { - console.log(body); -}); - -``` - -```python -import requests -headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer {access-token}' -} - -data = """ -undefined -""" -r = requests.post('http://localhost:21721/daemon/version', headers = headers, data = data) - -print(r.json()) - -``` - -```java -var uri = URI.create("http://localhost:21721/daemon/version"); -var client = HttpClient.newHttpClient(); -var request = HttpRequest - .newBuilder() - .uri(uri) - .header("Accept", "application/json") - .header("Authorization", "Bearer {access-token}") - .POST(HttpRequest.BodyPublishers.ofString(""" -undefined - """)) - .build(); -var response = client.send(request, HttpResponse.BodyHandlers.ofString()); -System.out.println(response.statusCode()); -System.out.println(response.body()); - -``` - -```go -package main - -import ( - "bytes" - "net/http" -) - -func main() { - - headers := map[string][]string{ - "Accept": []string{"application/json"}, - "Authorization": []string{"Bearer {access-token}"}, - } - - data := bytes.NewBuffer([]byte{jsonReq}) - req, err := http.NewRequest("POST", "http://localhost:21721/daemon/version", data) - req.Header = headers - - client := &http.Client{} - resp, err := client.Do(req) - // ... -} - -``` - -```shell -# You can also use wget -curl -X POST http://localhost:21721/daemon/version \ - -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ - --data ' -undefined -' - -``` - -
- -# Schemas - -

ShellStartRequest

- - - - - - -```json -{ - "connection": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| - -

ShellStartResponse

- - - - - - -```json -{ - "shellDialect": 0, - "osType": "string", - "osName": "string", - "ttyState": "string", - "temp": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|shellDialect|integer|true|none|The shell dialect| -|osType|string|true|none|The general type of operating system| -|osName|string|true|none|The display name of the operating system| -|ttyState|string|false|none|Whether a tty/pty has been allocated for the connection. If allocated, input and output will be unreliable. It is not recommended to use a shell connection then.| -|temp|string|true|none|The location of the temporary directory| - -

ShellStopRequest

- - - - - - -```json -{ - "connection": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| - -

ShellExecRequest

- - - - - - -```json -{ - "connection": "string", - "command": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| -|command|string|true|none|The command to execute| - -

ShellExecResponse

- - - - - - -```json -{ - "exitCode": 0, - "stdout": "string", - "stderr": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|exitCode|integer|true|none|The exit code of the command| -|stdout|string|true|none|The stdout output of the command| -|stderr|string|true|none|The stderr output of the command| - -

FsBlobResponse

- - - - - - -```json -{ - "blob": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|blob|string|true|none|The data uuid| - -

FsWriteRequest

- - - - - - -```json -{ - "connection": "string", - "blob": "string", - "path": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| -|blob|string|true|none|The blob uuid| -|path|string|true|none|The target filepath| - -

FsReadRequest

- - - - - - -```json -{ - "connection": "string", - "path": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| -|path|string|true|none|The target file path| - -

FsScriptRequest

- - - - - - -```json -{ - "connection": "string", - "blob": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| -|blob|string|true|none|The blob uuid| - -

FsScriptResponse

- - - - - - -```json -{ - "path": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|path|string|true|none|The generated script file path| - -

ConnectionQueryRequest

- - - - - - -```json -{ - "categoryFilter": "string", - "connectionFilter": "string", - "typeFilter": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|categoryFilter|string|true|none|The filter string to match categories. Categories are delimited by / if they are hierarchical. The filter supports globs.| -|connectionFilter|string|true|none|The filter string to match connection names. Connection names are delimited by / if they are hierarchical. The filter supports globs.| -|typeFilter|string|true|none|The filter string to connection types. Every unique type of connection like SSH or docker has its own type identifier that you can match. The filter supports globs.| - -

ConnectionQueryResponse

- - - - - - -```json -{ - "found": [ - "string" - ] -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|found|[string]|true|none|The found connections| - -

ConnectionInfoRequest

- - - - - - -```json -{ - "connections": [ - "string" - ] -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connections|[string]|true|none|The connections| - -

ConnectionInfoResponse

- - - - - - -```json -[ - { - "connection": "string", - "category": [ - "string" - ], - "name": [ - "string" - ], - "type": "string", - "rawData": {}, - "usageCategory": "shell", - "lastModified": "string", - "lastUsed": "string", - "state": {}, - "cache": {} - } -] - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The unique id of the connection| -|category|[string]|true|none|The full category path as an array| -|name|[string]|true|none|The full connection name path as an array| -|type|string|true|none|The type identifier of the connection| -|rawData|object|true|none|The raw internal configuration data for the connection. The schema for these is internal and should not be relied upon.| -|usageCategory|string|true|none|The category of how this connection can be used.| -|lastModified|string|true|none|The timestamp of when the connection configuration was last modified in ISO 8601| -|lastUsed|string|true|none|The timestamp of when the connection was last launched in ISO 8601| -|state|object|true|none|The internal persistent state information about the connection| -|cache|object|true|none|The temporary cache data for the connection| - -#### Enumerated Values - -|Property|Value| -|---|---| -|usageCategory|shell| -|usageCategory|tunnel| -|usageCategory|script| -|usageCategory|database| -|usageCategory|command| -|usageCategory|desktop| -|usageCategory|group| - -

ConnectionRefreshRequest

- - - - - - -```json -{ - "connection": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| - -

ConnectionAddRequest

- - - - - - -```json -{ - "name": "string", - "data": {}, - "validate": true, - "category": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|name|string|true|none|The connection name| -|data|object|true|none|The raw connection store data. Schemas for connection types are not documented, but you can find the connection data of your existing connections in the xpipe vault.| -|validate|boolean|true|none|Whether to perform a connection validation before adding it, i.e., probe the connection first. If validation is enabled and fails, the connection will not be added| -|category|string|false|none|The category uuid to put the connection in. If not specified, the default category will be used| - -

ConnectionAddResponse

- - - - - - -```json -{ - "connection": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connection|string|true|none|The connection uuid| - -

CategoryAddRequest

- - - - - - -```json -{ - "name": "string", - "parent": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|name|string|true|none|The category name| -|parent|string|true|none|The parent category uuid to put the new category in| - -

CategoryAddResponse

- - - - - - -```json -{ - "category": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|category|string|true|none|The category uuid| - -

ConnectionRemoveRequest

- - - - - - -```json -{ - "connections": [ - "string" - ] -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|connections|[string]|true|none|The connections to remove| - -

ConnectionBrowseRequest

- - - - - - -```json -{ - "directory": "string", - "connection": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|directory|string|true|none|The optional directory to browse to| -|connection|string|true|none|The connection uuid| - -

ConnectionToggleRequest

- - - - - - -```json -{ - "state": true, - "connection": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|state|boolean|true|none|The state to switch to| -|connection|string|true|none|The connection uuid| - -

ConnectionTerminalRequest

- - - - - - -```json -{ - "directory": "string", - "connection": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|directory|string|true|none|The optional directory to use as the working directory| -|connection|string|true|none|The connection uuid| - -

HandshakeRequest

- - - - - - -```json -{ - "auth": { - "type": "string", - "key": "string" - }, - "client": { - "type": "string" - } -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|auth|[AuthMethod](#schemaauthmethod)|true|none|none| -|client|[ClientInformation](#schemaclientinformation)|true|none|none| - -

HandshakeResponse

- - - - - - -```json -{ - "sessionToken": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|sessionToken|string|true|none|The generated bearer token that can be used for authentication in this session| - -

DaemonVersionResponse

- - - - - - -```json -{ - "version": "string", - "canonicalVersion": "string", - "buildVersion": "string", - "jvmVersion": "string", - "pro": true -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|version|string|true|none|The version of the running daemon| -|canonicalVersion|string|true|none|The canonical version of the running daemon| -|buildVersion|string|true|none|The build timestamp| -|jvmVersion|string|true|none|The version of the Java Virtual Machine in which the daemon is running| -|pro|boolean|true|none|Whether the daemon supports professional edition features| - -

AuthMethod

- - - - - - -```json -{ - "type": "string", - "key": "string" -} - -``` - -

Properties

- -oneOf - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|[ApiKey](#schemaapikey)|false|none|API key authentication| - -xor - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|[Local](#schemalocal)|false|none|Authentication method for local applications. Uses file system access as proof of authentication.

You can find the authentication file at:
- %TEMP%\xpipe_auth on Windows
- $TMP/xpipe_auth on Linux
- $TMPDIR/xpipe_auth on macOS

For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions.

As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file.| - -

ApiKey

- - - - - - -```json -{ - "type": "string", - "key": "string" -} - -``` - -API key authentication - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|type|string|true|none|none| -|key|string|true|none|The API key| - -

Local

- - - - - - -```json -{ - "type": "string", - "authFileContent": "string" -} - -``` - -Authentication method for local applications. Uses file system access as proof of authentication. - -You can find the authentication file at: -- %TEMP%\xpipe_auth on Windows -- $TMP/xpipe_auth on Linux -- $TMPDIR/xpipe_auth on macOS - -For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions. - -As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file. - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|type|string|true|none|none| -|authFileContent|string|true|none|The contents of the local file /xpipe_auth. This file is automatically generated when XPipe starts.| - -

ClientInformation

- - - - - - -```json -{ - "type": "string" -} - -``` - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|type|string|true|none|none| - -

ApiClientInformation

- - - - - - -```json -{ - "type": "string", - "name": "string" -} - -``` - -Provides information about the client that connected to the XPipe API. - -

Properties

- -allOf - discriminator: ClientInformation.type - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|[ClientInformation](#schemaclientinformation)|false|none|none| - -and - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|*anonymous*|object|false|none|none| -|» name|string|true|none|The name of the client.| - -

ClientErrorResponse

- - - - - - -```json -{ - "message": "string" -} - -``` - -Error returned in case of a client exception - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|message|string|true|none|The error message| - -

ServerErrorResponse

- - - - - - -```json -{ - "error": { - "cause": {}, - "stackTrace": [], - "suppressed": [], - "localizedMessage": "string", - "message": "string" - } -} - -``` - -Error returned in case of a server exception with HTTP code 500 - -

Properties

- -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|error|object|true|none|The exception information| -|» cause|object|false|none|The exception cause| -|» stackTrace|array|false|none|The java stack trace information| -|» suppressed|array|false|none|Any suppressed exceptions| -|» localizedMessage|string|false|none|Not used| -|» message|string|true|none|The error message| - diff --git a/beacon/README.md b/beacon/README.md index b2a6a62a9..f6e316a92 100644 --- a/beacon/README.md +++ b/beacon/README.md @@ -7,7 +7,7 @@ The XPipe beacon component is responsible for handling all communications betwee and the APIs and the CLI. It provides an API that supports all kinds of different operations. -For a full documentation, see the [OpenAPI spec](/../openapi.yaml) +For a full documentation, see the [OpenAPI spec](https://docs.xpipe.io/api) ### Inner Workings diff --git a/ext/base/src/main/java/io/xpipe/ext/base/action/RunScriptActionMenu.java b/ext/base/src/main/java/io/xpipe/ext/base/action/RunScriptActionMenu.java index e9abe79db..b31357bbe 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/action/RunScriptActionMenu.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/action/RunScriptActionMenu.java @@ -102,11 +102,6 @@ public class RunScriptActionMenu implements ActionProvider { public ActionProvider.Action createAction(DataStoreEntryRef store) { return new Action(store); } - - @Override - public List getChildren(List> batch) { - return List.of(); - } }; } } diff --git a/openapi.yaml b/openapi.yaml deleted file mode 100644 index 8d3057808..000000000 --- a/openapi.yaml +++ /dev/null @@ -1,1140 +0,0 @@ -openapi: 3.0.1 -info: - title: XPipe API Documentation - description: | - The XPipe API provides programmatic access to XPipe’s features. - You can get started by either using this page as an API reference or alternatively import the OpenAPI definition file into your API client of choice: - - OpenAPI .yaml specification - - The XPipe application will start up an HTTP server that can be used to send requests. - Note that this server is HTTP-only for now as it runs only on localhost. HTTPS requests are not accepted. - - You can either call the API directly or using the official [XPipe Python API](https://github.com/xpipe-io/xpipe-python-api). - - To start off with the API, you can query connections based on various filters. - With the matched connections, you can start remote shell sessions for each one and run arbitrary commands in them. - You get the command exit code and output as a response, allowing you to adapt your control flow based on command outputs. - Any kind of passwords and other secrets are automatically provided by XPipe when establishing a shell connection. - If a required password is not stored and is set to be dynamically prompted, the running XPipe application will ask you to enter any required passwords. - - See the authentication handshake below on how to authenticate prior to sending requests. - For development, you can also skip the authentication step by disabling it in the settings menu. - termsOfService: https://docs.xpipe.io/terms-of-service - contact: - name: XPipe - Contact us - url: mailto:hello@xpipe.io - version: "14.0" -externalDocs: - description: XPipe - Plans and pricing - url: https://xpipe.io/pricing -servers: - - url: http://localhost:21721 - description: XPipe Daemon API -paths: - /handshake: - post: - summary: Establish a new API session - description: | - Prior to sending requests to the API, you first have to establish a new API session via the handshake endpoint. - In the response you will receive a session token that you can use to authenticate during this session. - - This is done so that the daemon knows what kind of clients are connected and can manage individual capabilities for clients. - If your client is running on the same system as the daemon, you can choose the local authentication method to avoid having to deal with API keys. - If your client does not have file system access, e.g. if it is running remotely, then you have to use an API key. - - Note that for development you can also turn off the required authentication in the XPipe settings menu, allowing you to send unauthenticated requests. - operationId: handshake - security: [ ] - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/HandshakeRequest' - examples: - standard: - summary: API key handshake - value: { "auth": { "type": "ApiKey", "key": "" }, "client": { "type": "Api", "name": "My client name" } } - local: - summary: Local application handshake - value: { "auth": { "type": "Local", "authFileContent": "/xpipe_auth>" }, "client": { "type": "Api", "name": "My client name" } } - local-ptb: - summary: Local PTB application handshake - value: { "auth": { "type": "Local", "authFileContent": "/xpipe_ptb_auth>" }, "client": { "type": "Api", "name": "My client name" } } - responses: - '200': - description: The handshake was successful. The returned token can be used for authentication in this session. The token is valid as long as XPipe is running. - content: - application/json: - schema: - $ref: '#/components/schemas/HandshakeResponse' - '400': - $ref: '#/components/responses/BadRequest' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/query: - post: - summary: Query connections - description: | - Queries all connections using various filters. - - The filters support globs and can match the category names and connection names. - All matching is case insensitive. - operationId: connectionQuery - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionQueryRequest' - examples: - all: - summary: All - value: { "categoryFilter": "*", "connectionFilter": "*", "typeFilter": "*" } - simple: - summary: Simple filter - value: { "categoryFilter": "default", "connectionFilter": "local machine", "typeFilter": "*" } - globs: - summary: Globs - value: { "categoryFilter": "*", "connectionFilter": "*/podman/*", "typeFilter": "*" } - responses: - '200': - description: The query was successful. The body contains all matched connections. - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionQueryResponse' - examples: - standard: - summary: Matched connections - value: { "found": [ "f0ec68aa-63f5-405c-b178-9a4454556d6b" ] } - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/info: - post: - summary: Connection information - description: | - Queries detailed information about a connection. - operationId: connectionInfo - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionInfoRequest' - examples: - simple: - summary: Standard - value: { "connections": [ "f0ec68aa-63f5-405c-b178-9a4454556d6b" ] } - responses: - '200': - description: The query was successful. The body contains the detailed connection information. - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionInfoResponse' - examples: - standard: - summary: Connection information - value: { "infos": [ { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", "category": [ "default" ] , - "name": [ "local machine" ], "type": "local", "rawData": { }, "usageCategory": "shell", - "lastUsed": "2024-05-31T11:53:02.408504600Z", "lastModified": "2024-06-23T21:15:25.608097Z", - "state": { } } ] } - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/add: - post: - summary: Add new connection - description: | - Creates the new connection in the xpipe vault from raw json data. - This can also perform an optional validation first to make sure that the connection can be established. - - If an equivalent connection already exists, no new one will be added. - operationId: connectionAdd - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionAddRequest' - examples: - simple: - summary: Add new pwsh shell environment - value: { "name": "my connection", "validate": true, "category": "97458c07-75c0-4f9d-a06e-92d8cdf67c40", "data": - { - "type": "shellEnvironment", - "commands": null, - "host": { - "storeId": "f0ec68aa-63f5-405c-b178-9a4454556d6b" - }, - "shell": "pwsh", - "elevated": false, - } - } - responses: - '200': - description: The request was successful. The connection was added. - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionAddResponse' - examples: - standard: - summary: Connection information - value: { "connection": "36ad9716-a209-4f7f-9814-078d3349280c" } - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /category/add: - post: - summary: Add new category - description: | - Creates a new empty category in the vault. - - New categories always need a parent as it's not allowed to create root categories. - operationId: categoryAdd - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CategoryAddRequest' - examples: - simple: - summary: Add new category - value: { "name": "my category", "parent": "97458c07-75c0-4f9d-a06e-92d8cdf67c40" } - responses: - '200': - description: The request was successful. The category was added. - content: - application/json: - schema: - $ref: '#/components/schemas/CategoryAddResponse' - examples: - standard: - summary: Category information - value: { "category": "36ad9716-a209-4f7f-9814-078d3349280c" } - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/remove: - post: - summary: Remove connection - description: | - Removes a set of connection. This includes any possible children associated with the connection. - - Some connections, for example the local machine, can not be removed. - operationId: connectionRemove - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionRemoveRequest' - examples: - simple: - summary: Remove single connection - value: { "connections": [ "36ad9716-a209-4f7f-9814-078d3349280c" ] } - responses: - '200': - description: The removal was successful. - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/browse: - post: - summary: Open connection in file browser - description: | - Creates a new tab in the file browser and opens the specified connections with an optional starting directory. - operationId: connectionBrowse - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionBrowseRequest' - examples: - simple: - summary: Open local file browser - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" } - responses: - '200': - description: The request was successful. The connection was opened. - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/terminal: - post: - summary: Open terminal for shell connection - description: | - Launches a new terminal session for a connection with an optional specified working directory. - operationId: connectionTerminal - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionTerminalRequest' - examples: - simple: - summary: Open terminal for local shell - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" } - responses: - '200': - description: The request was successful. The connection was opened. - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/toggle: - post: - summary: Toggle state of a connection - description: | - Updates the state of a connection to either start or stop a session. - - This can be used for all kinds of services and tunnels. - operationId: connectionToggle - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionToggleRequest' - examples: - simple: - summary: Activate connection - value: { "connection": "36ad9716-a209-4f7f-9814-078d3349280c", "state": true } - responses: - '200': - description: The request was successful. The connection state was updated. - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /connection/refresh: - post: - summary: Refresh state of a connection - description: | - Performs a refresh on the specified connection. - - This will update the connection state information and also any children if the connection type has any. - operationId: connectionRefresh - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionRefreshRequest' - examples: - simple: - summary: Refresh connection - value: { "connection": "36ad9716-a209-4f7f-9814-078d3349280c" } - responses: - '200': - description: The request was successful. The connection state was updated. - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /shell/start: - post: - summary: Start shell connection - description: | - Starts a new shell session for a connection. If an existing shell session is already running for that connection, this operation will do nothing. - - Note that there are a variety of possible errors that can occur here when establishing the shell connection. - These errors will be returned with the HTTP return code 500. - operationId: shellStart - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ShellStartRequest' - examples: - local: - summary: Start local shell - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" } - responses: - '200': - description: The operation was successful. The shell session was started. - content: - application/json: - schema: - $ref: '#/components/schemas/ShellStartResponse' - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /shell/stop: - post: - summary: Stop shell connection - description: | - Stops an existing shell session for a connection. - - This operation will return once the shell has exited. - If the shell is busy or stuck, you might have to work with timeouts to account for these cases. - operationId: shellStop - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ShellStopRequest' - examples: - local: - summary: Stop local shell - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b" } - responses: - '200': - description: The operation was successful. The shell session was stopped. - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /shell/exec: - post: - summary: Execute command in a shell session - description: | - Runs a command in an active shell session and waits for it to finish. The exit code and output will be returned in the response. - - Note that a variety of different errors can occur when executing the command. - If the command finishes, even with an error code, a normal HTTP 200 response will be returned. - However, if any other error occurs like the shell not responding or exiting unexpectedly, an HTTP 500 response will be returned. - operationId: shellExec - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ShellExecRequest' - examples: - user: - summary: echo $USER - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", "command": "echo $USER" } - invalid: - summary: invalid - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", "command": "invalid" } - responses: - '200': - description: The operation was successful. The shell command finished. - content: - application/json: - schema: - $ref: '#/components/schemas/ShellExecResponse' - examples: - user: - summary: echo $USER - value: { "exitCode": 0, "stdout": "root", "stderr": "" } - fail: - summary: invalid - value: { "exitCode": 127, "stdout": "", "stderr": "invalid: command not found" } - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /fs/blob: - post: - summary: Store a raw blob to be used later - description: | - Stores arbitrary binary data in a blob such that it can be used later on to for example write to a remote file. - - This will return a uuid which can be used as a reference to the blob. - You can also store normal text data in blobs if you intend to create text or shell script files with it. - operationId: fsData - requestBody: - required: true - content: - application/octet-stream: - schema: - type: string - format: binary - responses: - '200': - description: The operation was successful. The data was stored. - content: - application/json: - schema: - $ref: '#/components/schemas/FsBlobResponse' - examples: - success: - summary: Success - value: { "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" } - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /fs/read: - post: - summary: Read the content of a remote file - description: | - Reads the entire content of a remote file through an active shell session. - operationId: fsRead - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/FsReadRequest' - examples: - simple: - summary: Read file - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", "path": "/home/user/myfile.txt" } - responses: - '200': - description: The operation was successful. The file was read. - content: - application/octet-stream: - schema: - type: string - format: binary - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /fs/write: - post: - summary: Write a blob to a remote file - description: | - Writes blob data to a file through an active shell session. - operationId: fsWrite - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/FsWriteRequest' - examples: - simple: - summary: Write simple file - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", "blob": "854afc45-eadc-49a0-a45d-9fb76a484304", "path": "/home/user/myfile.txt" } - responses: - '200': - description: The operation was successful. The file was written. - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /fs/script: - post: - summary: Create a shell script file from a blob - description: | - Creates a shell script in the temporary directory of the file system that is access through the shell connection. - - This can be used to run more complex commands on remote systems. - operationId: fsScript - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/FsScriptRequest' - examples: - standard: - summary: Standard write - value: { "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b", "blob": "854afc45-eadc-49a0-a45d-9fb76a484304" } - responses: - '200': - description: The operation was successful. The script file was created. - content: - application/json: - schema: - $ref: '#/components/schemas/FsScriptResponse' - examples: - success: - summary: Success - value: { "path": "/tmp/xpipe-123.sh" } - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' - /daemon/version: - post: - summary: Query daemon version - description: Retrieves version information from the daemon - operationId: daemonVersion - responses: - '200': - description: The operation was successful - content: - application/json: - schema: - $ref: '#/components/schemas/DaemonVersionResponse' - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' -components: - schemas: - ShellStartRequest: - type: object - properties: - connection: - type: string - description: The connection uuid - required: - - connection - ShellStartResponse: - type: object - properties: - shellDialect: - type: integer - description: The shell dialect - osType: - type: string - description: The general type of operating system - osName: - type: string - description: The display name of the operating system - ttyState: - type: string - description: Whether a tty/pty has been allocated for the connection. If allocated, input and output will be unreliable. It is not recommended to use a shell connection then. - temp: - type: string - description: The location of the temporary directory - required: - - shellDialect - - osType - - osName - - temp - ShellStopRequest: - type: object - properties: - connection: - type: string - description: The connection uuid - required: - - connection - ShellExecRequest: - type: object - properties: - connection: - type: string - description: The connection uuid - command: - type: string - description: The command to execute - required: - - connection - - command - ShellExecResponse: - type: object - properties: - exitCode: - type: integer - description: The exit code of the command - stdout: - type: string - description: The stdout output of the command - stderr: - type: string - description: The stderr output of the command - required: - - exitCode - - stdout - - stderr - FsBlobResponse: - type: object - properties: - blob: - type: string - description: The data uuid - required: - - blob - FsWriteRequest: - type: object - properties: - connection: - type: string - description: The connection uuid - blob: - type: string - description: The blob uuid - path: - type: string - description: The target filepath - required: - - connection - - blob - - path - FsReadRequest: - type: object - properties: - connection: - type: string - description: The connection uuid - path: - type: string - description: The target file path - required: - - connection - - path - FsScriptRequest: - type: object - properties: - connection: - type: string - description: The connection uuid - blob: - type: string - description: The blob uuid - required: - - connection - - blob - FsScriptResponse: - type: object - properties: - path: - type: string - description: The generated script file path - required: - - path - ConnectionQueryRequest: - type: object - properties: - categoryFilter: - type: string - description: The filter string to match categories. Categories are delimited by / if they are hierarchical. The filter supports globs. - connectionFilter: - type: string - description: The filter string to match connection names. Connection names are delimited by / if they are hierarchical. The filter supports globs. - typeFilter: - type: string - description: The filter string to connection types. Every unique type of connection like SSH or docker has its own type identifier that you can match. The filter supports globs. - required: - - categoryFilter - - connectionFilter - - typeFilter - ConnectionQueryResponse: - type: object - properties: - found: - type: array - description: The found connections - items: - type: string - description: The connection uuid - required: - - found - ConnectionInfoRequest: - type: object - properties: - connections: - type: array - description: The connections - items: - type: string - description: The unique id of the connection - required: - - connections - ConnectionInfoResponse: - type: array - items: - type: object - description: The array of information for each connection - properties: - connection: - type: string - description: The unique id of the connection - category: - type: array - description: The full category path as an array - items: - type: string - description: Individual category name - name: - type: array - description: The full connection name path as an array - items: - type: string - description: Individual connection name - type: - type: string - description: The type identifier of the connection - rawData: - type: object - description: The raw internal configuration data for the connection. The schema for these is internal and should not be relied upon. - usageCategory: - type: string - description: The category of how this connection can be used. - enum: - - shell - - tunnel - - script - - database - - command - - desktop - - group - lastModified: - type: string - description: The timestamp of when the connection configuration was last modified in ISO 8601 - lastUsed: - type: string - description: The timestamp of when the connection was last launched in ISO 8601 - state: - type: object - description: The internal persistent state information about the connection - cache: - type: object - description: The temporary cache data for the connection - required: - - connection - - category - - name - - type - - rawData - - usageCategory - - lastUsed - - lastModified - - state - - cache - ConnectionRefreshRequest: - type: object - properties: - connection: - type: string - description: The connection uuid - required: - - connection - ConnectionAddRequest: - type: object - properties: - name: - type: string - description: The connection name - data: - type: object - description: The raw connection store data. Schemas for connection types are not documented, but you can find the connection data of your existing connections in the xpipe vault. - validate: - type: boolean - description: Whether to perform a connection validation before adding it, i.e., probe the connection first. If validation is enabled and fails, the connection will not be added - category: - type: string - description: The category uuid to put the connection in. If not specified, the default category will be used - required: - - name - - data - - validate - ConnectionAddResponse: - type: object - properties: - connection: - type: string - description: The connection uuid - required: - - connection - CategoryAddRequest: - type: object - properties: - name: - type: string - description: The category name - parent: - type: string - description: The parent category uuid to put the new category in - required: - - name - - parent - CategoryAddResponse: - type: object - properties: - category: - type: string - description: The category uuid - required: - - category - ConnectionRemoveRequest: - type: object - properties: - connections: - type: array - description: The connections to remove - items: - type: string - description: The unique id of the connection - required: - - connections - ConnectionBrowseRequest: - type: object - properties: - directory: - type: string - description: The optional directory to browse to - connection: - type: string - description: The connection uuid - required: - - directory - - connection - ConnectionToggleRequest: - type: object - properties: - state: - type: boolean - description: The state to switch to - connection: - type: string - description: The connection uuid - required: - - state - - connection - ConnectionTerminalRequest: - type: object - properties: - directory: - type: string - description: The optional directory to use as the working directory - connection: - type: string - description: The connection uuid - required: - - directory - - connection - HandshakeRequest: - type: object - properties: - auth: - $ref: '#/components/schemas/AuthMethod' - client: - $ref: '#/components/schemas/ClientInformation' - required: - - auth - - client - HandshakeResponse: - type: object - properties: - sessionToken: - type: string - description: The generated bearer token that can be used for authentication in this session - required: - - sessionToken - DaemonVersionResponse: - type: object - properties: - version: - type: string - description: The version of the running daemon - canonicalVersion: - type: string - description: The canonical version of the running daemon - buildVersion: - type: string - description: The build timestamp - jvmVersion: - type: string - description: The version of the Java Virtual Machine in which the daemon is running - pro: - type: boolean - description: Whether the daemon supports professional edition features - required: - - version - - canonicalVersion - - buildVersion - - jvmVersion - - pro - AuthMethod: - discriminator: - propertyName: type - mapping: - apiKey: '#/components/schemas/ApiKey' - local: '#/components/schemas/Local' - oneOf: - - $ref: '#/components/schemas/ApiKey' - - $ref: '#/components/schemas/Local' - ApiKey: - description: API key authentication - type: object - properties: - type: - type: string - key: - type: string - description: The API key - required: - - key - - type - Local: - description: | - Authentication method for local applications. Uses file system access as proof of authentication. - - You can find the authentication file at: - - %TEMP%\xpipe_auth on Windows - - $TMP/xpipe_auth on Linux - - $TMPDIR/xpipe_auth on macOS - - For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions. - - As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file. - type: object - properties: - type: - type: string - authFileContent: - type: string - description: The contents of the local file /xpipe_auth. This file is automatically generated when XPipe starts. - required: - - authFileContent - - type - ClientInformation: - type: object - discriminator: - propertyName: type - properties: - type: - type: string - required: - - type - ApiClientInformation: - description: Provides information about the client that connected to the XPipe API. - allOf: - - $ref: '#/components/schemas/ClientInformation' - - type: object - properties: - name: - type: string - description: The name of the client. - required: - - name - ClientErrorResponse: - description: Error returned in case of a client exception - type: object - properties: - message: - type: string - description: The error message - required: - - message - ServerErrorResponse: - description: Error returned in case of a server exception with HTTP code 500 - type: object - properties: - error: - type: object - description: The exception information - properties: - cause: - type: object - description: The exception cause - stackTrace: - type: array - description: The java stack trace information - suppressed: - type: array - description: Any suppressed exceptions - localizedMessage: - type: string - description: Not used - message: - type: string - description: The error message - required: - - message - required: - - error - responses: - Success: - description: The action was successfully performed. - BadRequest: - description: Bad request. Please check error message and your parameters. - content: - application/json: - schema: - $ref: '#/components/schemas/ClientErrorResponse' - Unauthorized: - description: Authorization failed. Please supply a `Bearer` token via - the `Authorization` header. - Forbidden: - description: Authorization failed. Please supply a valid `Bearer` token via - the `Authorization` header. - NotFound: - description: The requested resource could not be found. - InternalServerError: - description: Internal error. - content: - application/json: - schema: - $ref: '#/components/schemas/ServerErrorResponse' - securitySchemes: - bearerAuth: - type: http - scheme: bearer - description: The bearer token used is the session token that you receive from the handshake exchange. -security: - - bearerAuth: [ ]