Skip to main content

Documentation for ScryLab v0.7.1

Changelogs

Signal Upload (Binary)

POST /api/signals/upload

Uploads a signal as multipart/form-data. Unlike POST /api/signals/send (inline JSON), the file contents are transferred directly – the server needs no host file path and therefore no host filesystem access. This is the recommended way for large signals and works inside the Flatpak sandbox too.

Tip

Step-by-step guide: Import Data from Python & MATLAB

Request

POST /api/signals/upload HTTP/1.1
Host: localhost:5678
Content-Type: multipart/form-data; boundary=...

Form Fields

FieldTypeRequiredDescription
filefileYes.npz or .mat with arrays y (required), x, z, master (optional)
metaJSON stringNo{name, y_unit, x_unit, z_unit, x_domain, master_domain, target_source_id, overwrite}

Metadata can be passed either as a meta JSON field or as individual form fields (name, y_unit, x_unit, z_unit, target_source_id). name and target_source_id are required. The fields have the same meaning as in POST /api/signals/send.

overwrite is only read from the meta JSON, not as a form field of its own. Set it to true to replace an existing signal with the same name in the target source.

File format

  • NumPy (.npz): Must contain an array named y. Optional: x, z and master.
  • MATLAB (.mat): Must contain a variable named y. Optional: x, z and master.

Response

Status Code: 200 OK

{
"status": "ok",
"result": {
"signal_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "Large Signal",
"sample_count": 1000000
}
}

Errors

StatusMeaning
400Missing file field, invalid metadata, or meta is not a JSON object
404target_source_id not found
415Unsupported file type (only .npz / .mat)
500Server error while storing or loading the file

POST /api/signals/upload_batch

Uploads multiple signals in a single request. This saves the HTTP round-trips of many individual uploads – ideal for pushing many (large) channels, e.g. an entire measurement, efficiently at once.

Request

POST /api/signals/upload_batch HTTP/1.1
Host: localhost:5678
Content-Type: multipart/form-data; boundary=...

Form Fields

FieldTypeRequiredDescription
filefile (repeated)YesOne .npz/.mat upload per signal
metaJSON arrayNoOne object per file, in the same order
target_source_idstringNoDefault target for signals without their own target_source_id

Each meta object accepts the same fields as /api/signals/upload, including overwrite, and needs a name. Files are matched to meta entries by order.

Response

Status Code: 200 OK

{
"status": "ok",
"result": {
"signals": [
{"signal_id": "...", "name": "Channel A", "sample_count": 1000000},
{"signal_id": "...", "name": "Channel B", "sample_count": 1000000}
],
"errors": []
}
}

A single failing signal does not abort the request. Successful imports are listed in signals, failures in errors (each with index and error). The status stays 200 even if every file failed, so always check errors. A file that is neither .npz nor .mat is reported there as well, not as 415.

Errors

StatusMeaning
400Missing file field or meta is not a JSON array of objects
500Server error