Ozone API

Ozone API is is provided to all applications running over Ozone. The API is the global object named api.

Ozone API is can be used following this syntax:
api . namespace . action

For example, the settings API can be used to set a global settings by using the following command:

api.settings.set("key", "value", "general.json")

Namespaces

Namespaces act like categories of functionality, and are used primarily by the system for grouping application permissions. Learn More about permissions.

All APIs

settings

APIparametersdescription
getkey / "all", file_nameread settings values from a settings file
setkey, value, file_nameset settings values in a settings file
removekey, file_nameremove a settings key from a settings file

fileGet

APIparametersdescription
readfile_pathread a file, returns a file node
streamfile_pathread a file, returns a stream-able file node

fileSet

APIparametersdescription
writefile_path, dataupdate or create a file
mkdirpathmake a directory
mkdirppathmake nested directories
removepathremove a file or directory at path

fileUtil

APIparametersdescription
listpathlist all contents of a directory
existspathreturns a boolean about existence of a path
openpathautomatically open a file in the right app via Ozone

utility

APIparametersdescription
getMimepathget mime type from a file path
normpathnormalize a file system path
getNamespacesnoneget all permission namespaces

system

APIparametersdescription
ensureRootpathensure a path is rooted correctly
parentOfpathget the parent directory of a given path

apps

APIparametersdescription
openpath, params[], modeopen an application with params

store

APIparametersdescription
installFromURLapp_urlinstall an app directly from a URL
installbase, files, metadatainstall an app from local resources

events

APIparametersdescription
registerdefinedKeyreturns a channel key your window can broadcast events to
broadcastchannelKey, databroadcast events with data to your channel key
listenchannelKeyreturns a handler that listens to channel with its key

appEmbed

APIparametersdescription
createappTagreturns a URL and an event channelKey for embedding other apps

appStorage

APIparametersdescription
getkey / "all", file_nameread stored values from the app storage file
setkey, value, file_nameset values for keys in the app storage file
removekey, file_nameremove a storage key from the app storage file

Reading Parameters

api.params returns a list of all parameters passed when opening the current application.