Web Query

Contents

URL Parameters

SlowPlot

URL

Case 1: Start from blank

http://ADDRESS:PORT/slowplot.html?OPTIONS

Case 2: Making a plot of (a) specified channel(s)

http://ADDRESS:PORT/slowplot.html?channel=CHANNELS&OPTIONS

Case 3: Using saved configuration file

http://ADDRESS:PORT/slowplot.html?config=CONFIG_FILE&OPTIONS

Mandatory Options

Optional Options

SlowDash

URL

http://ADDRESS:PORT/slowdash.html?config=CONFIG_FILE&OPTIONS

Mandatory Options

Optional Options

SlowCruise

URL

http://ADDRESS:PORT/slowcruise.html?config=CONFIG_FILE&OPTIONS

Mandatory Options

Optional Options

Web API

Ping

Request

GET http://ADDRESS:PORT/api/ping

Reply

"pong"

Echo Request

Request

GET http://ADDRESS:PORT/api/echo/PATH?OPTIONS

Reply

{
    "URL": "echo/PATH?OPTIONS",
    "Path": [ PATH_ELEMENTS ],
    "Opts": { OPTION_ELEMENTS }
}

Getting Project Configuration

Request

GET http://ADDRESS:PORT/api/config

Reply Example (ATDS Project)

{
    "project": {
        "name": "ATDS",
        "title": "Atomic Tritium Demonstrator at UW (ATDS)"
    },
    "style": {
        "theme": "light"
    },
    "contents": {
        "slowdash": [
            {
                "name": "ATDS",
                "mtime": 1677724206.5829866,
                "title": "",
                "description": "Atomic Tritium Demonstrator at UW Top Level",
                "config_file": "slowdash-ATDS.json"
            }
        ],
        "slowplot": [
            {
                "name": "RTD_ACC",
                "mtime": 1678019620.6981564,
                "title": "Accomodator RTDs",
                "description": "Accomodator RTDs",
                "config_file": "slowplot-RTD_ACC.json"
            },
            {
                "name": "ATDS",
                "mtime": 1677726950.1148098,
                "title": "ATDS Overview",
                "description": "ATDS Standard Plots",
                "config_file": "slowplot-ATDS.json"
            }
        ],
        "slowcruise": [
            {
                "name": "AllPlots",
                "mtime": 1678019441.923559,
                "title": "ATDS All Plots",
                "description": "Loop over all Dashboards and Plots",
                "config_file": "slowcruise-AllPlots.yaml"
            }
        ],
        "alarms": [
            {
                "name": "normal",
                "mtime": 1630663955.5648437,
                "title": "",
                "description": "",
                "config_file": "alarms-normal.yaml"
            }
        ]
    }
}

Channel List Query

Request

GET http://ADDRESS:PORT/api/channels

Reply

[
    { "name": CH0_NAME, "type": CH0_TYPE },
    ...
]

Data Query

Request

GET http://ADDRESS:PORT/api/data/CHANNEL_LIST?OPTIONS

channel list is:

CH0,CH1,CH2...

options are:

length=LENGTH [default 3600]
to=TO [default 0 (now)]
resample=RESAMPLE [default 0 (auto)]
reducer=REDUCER [default "last"]

For details see the Data Model section.

Fetching Blob Data Content

Request

GET http://ADDRESS:PORT/api/blob/CHANNEL/ID

Listing User Configuration Entries

Request

GET http://ADDRESS:PORT/api/config/list

Listing User Configuration Files

Request

GET http://ADDRESS:PORT/api/config/filelist

Fetching User Configuration Files

Request

GET http://ADDRESS:PORT/api/config/file/FILENAME

Uploading User Configuration Files

Request

POST http://ADDRESS:PORT/api/config/file/NAME?OPTIONS
[ with JSON text as contents ]

Response

JavaScript Snippet

fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json; charset=utf-8' },
    body: JSON.stringify(doc, null, 2)
})
.then(response => {
    if (response.status == 202) {
       // file already exists. retry with overwrite=yes to overwrite
       return;
    }
    if (! response.ok) {
        throw new Error(response.status + " " + response.statusText);
    }
    //// success ////
    ....
})
.catch(e => {
    //// error  ////
    ....
});

Sending Commands to User Modules

Request

POST http://ADDRESS:PORT/api/control
[ with JSON text as contents ]

Response

JavaScript Snippet

A typical JavaScript would look like:

fetch(url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json; charset=utf-8' },
    body: JSON.stringify(doc, null, 2)
})
.then(response => {
    if (! response.ok) {
        throw new Error(response.status + " " + response.statusText);
    }
    return response.json();
})
.then(doc => {
    if ((doc.status ?? '').toUpperCase() == 'ERROR') {
        throw new Error(doc.message ?? '');
    }
    //// success ////
    ....
})
.catch(e => {
    //// error ////
    ....
});