Product/components used and version/fix level:
Cumulocity Prod - 1016.0.324
Detailed explanation of the problem:
I am using a custom application with c8y version 10.16. I would like to understand the differences in the way measurements are called.
First approach by using measurements service:
constructor(private measurements: MeasurementService) { }
getLastManualInpDate(
boilerId: any
): Promise<IResultList<IMeasurement>> {
const filters: object = {
withTotalElements: true,
source: boilerId,
withTotalPages: true,
dateTo: new Date().toISOString(),
valueFragmentType: 'user_manualMeasurement',
revert: true
};
return this.measurements.list(filters);
}
Second Approach using fetch client:
async waterAnalysis_ManualInput(boilerId: any, valueFragmentSeries: string) {
const dateTo = new Date();
let payload = {
withTotalElements: true,
source: boilerId,
withTotalPages: true,
dateTo: new Date().toISOString(),
valueFragmentType: 'user_manualMeasurement',
revert: true
};
try {
const res = await this.fetchClient.fetch(`/measurement/measurements`,
{
method: 'GET',
params: payload,
headers: {
'Content-Type': 'application/json'
},
}
);
const resp = await res.json();
return resp;
} catch (err) {
}
}
Both ways allow me to retrieve the data and view the API requests in the network tab. What is the best approach between these two methods ?