File Tools

runDbQuery

get

Open a database file (sqlite), run a query, and return the results. If sql and table are not provided, this will return all rows from all tables in the database.

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

filePathstringOptional

Full file path. Also see openFileDialog.

tablestringOptional

If provided, will return the full content of the table using the same parsing as used by getFileContent.

sqlstringOptional

SQL query to run against the database.

Responses
200
successful operation
application/json
get
GET /api/command/runDbQuery HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "getFileContent",
    "reply": "getFileContent",
    "success": false
  }
}

convertToJson

get

Takes a supplied string of structured data (xml, csv, other json) and converts it to a JSON object..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

contentstringOptional

String contents that should be parsed and converted.

Example: <item><child name="hello">world</child></item>
typestringOptional

type of the input string (xml, csv, json)

Example: xml
flattennumberOptional

boolean value, if true, the data will be flattened into 1 level deep simplified object of key-value pairs.

Example: 1
Responses
200
successful operation
application/json
get
GET /api/command/convertToJson HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "convertToJson",
    "json": {},
    "reply": "convertToJson",
    "success": true
  }
}

downloadImage

get

Download an image file from the Internet or parse it from a data url and save it to a local temporary file..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

urlstringOptional

Optional: Full url to the image file

datastringOptional

Optional: a "data url" construct like "data:image/jpeg;base64,BASE_64_DATA..."

Responses
200
successful operation
application/json
get
GET /api/command/downloadImage HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "downloadImage",
    "reply": "downloadImage",
    "success": true
  }
}

encodeImage

get

Encode an image file from the local filesystem into a data url.

Query parameters
filestringOptional

Full path to the image file

Responses
200
successful operation
application/json
get
GET /api/command/encodeImage HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "encodeImage",
    "reply": "encodeImage",
    "success": true
  }
}

getDirectoryContent

get

Gets a list of all entries in the specified directory..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

dirPathstringOptional

Full file path. Also see openFileDialog.

Responses
200
successful operation
application/json
get
GET /api/command/getDirectoryContent HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "getDirectoryContent",
    "directory": "",
    "reply": "getDirectoryContent",
    "success": true
  }
}

getFileContent

get

Read a file or url and return its data - especially useful when polling files for data..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

filePathstringOptional

Full file path. Also see openFileDialog.

urlstringOptional

Url to fetch.

parseMethodsstringOptional

Comma-separated string. Applies multiple parse methods to the data. Options: b64 (returns b64 encoded raw data), text (returns utf-8 encoded string), table (uses our csv, xml, json, Excel, db parser to extract tabular data), json (expects the file content to be XML or json, parses it, and returns a JavaScript object)

flattenstringOptional

boolean value, if true, the data will be flattened into 1 level deep simplified object of key-value pairs.

Responses
200
successful operation
application/json
get
GET /api/command/getFileContent HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "getFileContent",
    "reply": "getFileContent",
    "success": true
  }
}

openDirectoryDialog

get

Open a file browser to select a directory and return its full path along with its file contents..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

captionstringOptional

Message for the title bar

Example: Select A Directory
dirstringOptional

Optional, folder to search

Responses
200
successful operation
application/json
Responseobject
get
GET /api/command/openDirectoryDialog HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{}

openFileDialog

get

Open a file browser to select a file and return its full path..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

captionstringOptional

Message for the title bar (does not work on all platforms)

Example: Select A File
dirstringOptional

Optional, folder to search

filterstringOptional

File format to look for, ie 'Images (*.png *.jpg .jpeg);;XML files (.xml)'. Multiple patterns are separated by ';;'.

Example: Images (*.png *.jpg *.jpeg);;XML files (*.xml)
Responses
200
successful operation
application/json
Responseobject
get
GET /api/command/openFileDialog HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{}

openUrl

get

Open a url in the system browser..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

urlstringOptional

Url to open

Example: https://newbluefx.com
Responses
200
successful operation
application/json
get
GET /api/command/openUrl HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "openUrl",
    "reply": "openUrl",
    "success": true
  }
}

setFileContent

get

Write the supplied data to a file..

Query parameters
requestIdstringOptional

optional id to track this command, will be returned in the response

contentstringOptional

Data to write to the file

filePathstringOptional

Full file path. If omitted, will trigger the save dialog to open.

hasBinaryContentstringOptional

Set to 1 if the content is binary data.

defaultnamestringOptional

Optional, default name for the save dialog.

userContextstringOptional

Optional, user context to pass back in the notification.

Responses
200
successful operation
application/json
get
GET /api/command/setFileContent HTTP/1.1
Host: 127.0.0.1:9022
Accept: */*
{
  "result": {
    "command": "setFileContent",
    "error": "Content size is 0",
    "reply": "setFileContent",
    "setFileContentRequest": "SFCREQ_1",
    "success": true,
    "userContext": ""
  }
}

Last updated