Class MeasurementService

This class allows for managing measurements.

Hierarchy (view full)

Constructors

Methods

  • Removes a measurement with given id.

    Parameters

    Returns Promise<IResult<null>>

    Response wrapped in [[IResult]]

    As of version 10.16.0.0 and the usage of the time series database, deleting a single measurement via id is not supported any more.

    Example


    const id: number = 1;

    (async () => {
    const {data, res} = await measurementService.delete(id);
    })();
  • Gets the details of selected measurement.

    Parameters

    • entityOrId: string | number | IIdentified

      Entity or Id of the entity.

    Returns Promise<IResult<IMeasurement>>

    Response wrapped in [[IResult]]

    As of version 10.16.0.0 and the usage of the time series database, reading a single measurement via id is not supported any more.

    Example


    const measurementId: number = 1;

    (async () => {
    const {data, res} = await measurementService.detail(measurementId);
    })();
  • Retrieves the measurement file based on the provided filter parameters and headers, but only if the response is 200. If the response is 202, the file is processed in the background and the file is sent by email.

    Example


    const filter: IFetchResponse = {
    dateFrom: "2024-08-11T12:13:00+02:00"
    dateTo: "2024-08-12T12:15:00+02:00"
    source: "32666427"
    valueFragmentSeries: "accelerationX"
    valueFragmentType: "c8y_Acceleration"
    };

    const headers = {
    accept: 'text/csv'
    }

    (async () => {
    const response = await measurementService.getMeasurementsFile(filter, headers);
    if (response.status === 200) {
    const blob = await response.blob();
    }
    })();

    Parameters

    • params: IMeasurementFilter
    • headers: {
          accept: string;
      }

      The headers for the request.

      • accept: string

    Returns Promise<IFetchResponse>

    A promise that resolves to the fetch response.