Skip to content

Monitoring Web Service Api Documentation

Obtaining an API key

Authentication is handled using Bearer authentication, which consists of sending an API key that is unique to your account with each request. This key should be kept secret and not shared with anyone.

To include your API key in your request, add an HTTP Authorization header, consisting of the Bearer keyword and the token, like so:

http
Authorization: Bearer YOUR_API_KEY

API Reference

Extract Data

Get a list of records for a specific site.

Note: Nothing is returned if the station is not configured to register the requested data types.

http
POST https://api.monitoring.softdb.com/inquiry/v2/records

Parameters for the request

Query parameters:

AttributeTypeRequiredDescription
projectstringYesThe project ID. Contact Soft dB to get it.
timestringYesThe start time for the requests. The format is ISO 8601.
endTimestringNoThe end time for the request. The format is ISO 8601.
formatstringNoThe format of the response. The default is json. The other option is csv.
timezonestringNoThe timezone used for the average calculation. The default is the timezone of the site location.

Body parameters:

The body of the request is a JSON object that contains an array of queries, like so:

json
{
  "queries": [
    ... // List of queries
  ]
}

Each query object has the following fields:

AttributeTypeRequiredDescription
typestringYesOne of sound, vibration, weather or overpressure.
datastringYesThe name of the data. Please see the Data Reference.
spectrumstringNoRequired if wanted to extract spectrum data. Can be 1 for Octave, 3 for 1/3 Octave or fft for the FFT.
periodnumberNoThe duration of each data points in seconds, aligned on the clock. For example, if the period is 3600, each data points will be of 1 hour long every hour.

Depending of the type attribute, more attributes may be required.

If the type is sound:

AttributeTypeRequiredDescription
ponderationstringYesOne of a, c or z.
statsnumberConditionallyRequired if data is ln. The number must be between 1 and 100.

If the type is vibration:

AttributeTypeRequiredDescription
subTypestringYesOne of velocity, or acceleration.
axisstringYesOne of x, y, z or v_sum

If the type is weather:

AttributeTypeRequiredDescription
aggregatestringYesOne of min, max or avg.

Here is an example of queries to get the LAeq, the LA50% and the Average temperature for every 15 minutes:

json
[
  {
    "type": "sound",
    "data": "leq",
    "ponderation": "a",
    "period": 900
  },
  {
    "type": "sound",
    "data": "ln",
    "ponderation": "a",
    "stats": 50,
    "period": 900
  },
  {
    "type": "weather",
    "data": "temperature",
    "aggregate": "avg",
    "period": 900
  }
]

Success Response

Returns [200 OK] and a list of records. Each records has the folowwing response attributes:

AttributeTypeDescription
startTimestringThe start time of the response in the ISO 8601 format.
endTimestringThe end time of the response in the ISO 8601 format.
labelstringThe name of the requested data type.
unitstringThe SI unit of the data.
dataobjectThe response data.
data.startarrayList of start time. It's a list of number representing the UNIX time in milliseconds.
data.endarrayList of end time. It's a list of number representing the UNIX time in milliseconds.
data.valuearrayList of data point. It's a list of number.
data.saturatedarrayList of saturation flags. It is 1 if saturated and 0 if not saturated.

Here is an example:

json
[
    {
        "startTime": "2024-08-22T10:00:00.000Z",
        "endTime": "2024-08-22T18:57:00.000Z",
        "label": "LAeq 1h (dB)",
        "unit": "dB",
        "data": {
            "start": [
                1724320800000,
                1724324400000,
                1724328000000,
                1724331600000,
                1724335200000,
                1724338800000,
                1724342400000,
                1724346000000,
                1724349600000
            ],
            "end": [
                1724324400000,
                1724328000000,
                1724331600000,
                1724335200000,
                1724338800000,
                1724342400000,
                1724346000000,
                1724349600000,
                1724353020000
            ],
            "saturated": [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            ],
            "value": [
                53.83112,
                54.467808,
                54.42323,
                56.282578,
                55.718815,
                55.36246,
                55.501812,
                55.89459,
                56.359077
            ]
        }
    }
  ... // Other queries results
]

Error Responses

HTTP CodeDescription
400One of the parameter is invalid. Please see the response body for more details.
401The auth token is missing in the header or it is invalid.
403You don't have access to this ressource. If you believe this is an error, please contact Soft dB.
5xxTry again later. If the error persist, please contact Soft dB for further assitances.

Example in Python

py
import requests

# Please contact Soft dB to get your API token
API_TOKEN = "your_api_token"

START_TIME = "2024-03-20T00:00:00Z"
END_TIME = "2024-03-21T00:00:00Z"

# Please contact Soft dB to get your project ID
PROJECT_ID = "your_project_id"

queries = [
    {"type": "sound", "data": "leq", "ponderation": "a", "period": 3600},
    {"type": "sound", "data": "ln", "ponderation": "a", "stats": 10, "period": 3600},
    {
        "type": "weather",
        "data": "temperature",
        "aggregate": "avg",
        "period": 3600,
    },
    {
        "type": "weather",
        "data": "pressure",
        "aggregate": "avg",
        "period": 3600,
    },
]

API_URL = "https://api.monitoring.softdb.com/inquiry/v2/records"


def fetch_softdb_data():
    headers = {
        "Authorization": f"Bearer {API_TOKEN}",
    }

    params = {
        "project": PROJECT_ID,
        "time": START_TIME,
        "endTime": END_TIME,
        "format": "json",
    }

    response = requests.post(
        API_URL, headers=headers, params=params, json={"queries": queries}
    )

    if response.status_code == 200:
        return response.json()

    raise Exception(f"Failed to fetch data from Soft dB API: {response.text}")


if __name__ == "__main__":
    data = fetch_softdb_data()
    print(data)

Data Reference

Sound

  • leq
  • lpk
  • lftm5
  • l_min
  • l_max
  • ln

Vibration Velocity

  • rms
  • peak
  • kbf_max
  • kbftm
  • vb1_max
  • vb2_max
  • vb3_max

Vibration Acceleration

  • rms
  • rms_wm
  • peak
  • peak_wm

Weather

  • humidity
  • pressure
  • rain_rate
  • temperature
  • wind_direction
  • wind_speed