Cumulocity Web SDK - v1021.62.8
    Preparing search index...

    Class MeasurementService

    This class allows for managing measurements.

    Hierarchy (View Summary)

    Index

    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

      Returns Promise<IFetchResponse>

      A promise that resolves to the fetch response.