Zum Hauptinhalt springen

Communication Protocol

The default TCP port is 8001. Set it with --port, TESSONICS_SRS_SERVER_PORT, or server.port. End each JSON request and response with a zero byte (\x00). A connection can carry multiple exchanges.

If you are new to the API, start with the SRS API guide. This page explains how to frame packets, choose a request, and interpret the response.

1. Send a request packet​

Every request is a JSON object. The top-level key tells the SRS system what to do:

{"get":"<resource>"}

Use get to query information or request an acquisition. Add a payload when needed. version-info and hardware-info need none. acq needs acquisition details.

{"put":"<resource>","payload":{}}

Use put to update configuration or templates.

Terminate each request with a zero byte (\x00). The notation below shows one complete request packet. Send the \x00 byte after the closing brace. It is not part of the JSON text.

{"get":"version-info"}\x00

2. Read one response packet​

Read the TCP stream until the next zero byte. The bytes before it form one JSON response. A successful response usually has a type and a payload:

{"type":"version-info","payload":{"semantic":"...","githash":"...","timestamp":"..."}}

The response type identifies its payload. get acq returns measurement-info. Successful put requests return status with payload ok. See the API reference for response fields.

After reading a complete response, reuse the connection for the next request and response.

3. Choose a resource​

RequestPayloadSuccessful response
get version-infoNoneversion-info (VERSION-INFO)
get hardware-infoNonehardware-info (HARDWARE-INFO)
get configNoneconfig (Auditor Config)
get config-schemaNoneJSON schema for Auditor Config
get acq-configNoneacq-config (Acquire Config)
get acq-config-schemaNoneCurrent acquisition configuration JSON schema
get acq-testAcquisition settings object in payloadmeasurement-data with uid, timestamp, and btdm_z_b64
get acqAcquire Requestmeasurement-info (Measurement Info)
get recent-measurementsFilter object with optional earliest, limit, and offsetmeasurements array
get measurementObject containing the measurement uidmeasurement when the UID is found
get templatesNonetemplates (Template Info)
get templates-schemaNoneJSON schema for Template Info
put configAuditor configuration objectstatus with payload ok
put acq-configComplete Acquire Configstatus with payload ok
put templatesTemplate Info objectstatus with payload ok

get measurement and get recent-measurements require storage. See Obtaining Measurements or Managing Measurement History.

get acq-test performs an acquisition with payload settings applied to the current config. It saves the result as acq-test when storage is available.

Errors​

If a request cannot be handled, the SRS system can return an error response instead of the expected success response:

{
"type": "error",
"payload": {
"code": 2,
"message": "syntax",
"detail": "Optional additional information"
}
}

detail is optional. The documented codes are:

CodeMessageMeaning
1systemA system-level error occurred.
2syntaxThe request is not valid JSON or does not follow the request format.
3contentThe request content is invalid or a required field is missing.
4part-idThe acq request is missing a part ID. This error is not active yet.
5location-idThe acq request is missing a location ID. This error is not active yet.

Send valid JSON packets without comments or trailing commas.