# Where do I get the Fragment and Series names for methods relying on the Web SDK

**URL:** <https://community.cumulocity.com/t/where-do-i-get-the-fragment-and-series-names-for-methods-relying-on-the-web-sdk/4312>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [August 28, 2023, 8:58pm UTC](https://community.cumulocity.com/t/where-do-i-get-the-fragment-and-series-names-for-methods-relying-on-the-web-sdk/4312 "2023-08-28T20:58:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luclib](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@luclib](https://community.cumulocity.com/u/luclib)\
**Post date:** [August 28, 2023, 8:58pm UTC](https://community.cumulocity.com/t/where-do-i-get-the-fragment-and-series-names-for-methods-relying-on-the-web-sdk/4312/1 "2023-08-28T20:58:20Z")

</div>

I am following the [Web Development Tutotrial](https://community.cumulocity.com/t/cumulocity-iot-web-development-tutorial-part-2-create-your-first-component/5569) and trying to create an application that extracts two custom types of data from Cumulocity.

More specifically, I am trying to get existing as well as new incoming measurements from the backend. To do so, I created an Angular service and injected it with the **InventoryService** and the **MeasurementsService** from the Web SDK.

However, I want to create a method that uses the following 2 custom classes I modelled using the SmartRestTemplate:

**Mode Usage**

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/5/d/5d0ff2456fec8ac6b8ffc4b2fbb0d92e6ff4a77f.png)

…and **Tube Set Type**

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/c/7/c7c8ec85ec194a6f758e1346fcac16bb6fe76533.png)

While I am confident with how I modeled my method to retrieve all records from C8Y with the instance of my InventoryService, I am less clear on how to reproduce the following method using my own MeasurementsService.

This is the method from the tutorial that I am referring to:

```auto
private async loadLatestMeasurement(
    deviceId: string,
    measurementFragment: string,
    measurementSeries: string
  ) {
    const filter = {
      source: deviceId,
      dateFrom: '1970-01-01',
      dateTo: new Date().toISOString(),
      valueFragmentType: measurementFragment,
      valueFragmentSeries: measurementSeries,
      pageSize: 1,
      revert: true,
    };

    try {
      const response = await this.measurementService.list(filter);

      if (
        !response.data ||
        response.data.length != 1 ||
        !has(response.data[0], `${measurementFragment}.${measurementSeries}`)
      ) {
        return;
      }

      const temperatureValue: number = get(
        response.data[0],
        `${measurementFragment}.${measurementSeries}.value`
      );
      const temperatureUnit: string = get(
        response.data[0],
        `${measurementFragment}.${measurementSeries}.unit`
      );

      this.temperatureMeasurement$.next({ value: temperatureValue, unit: temperatureUnit });
    } catch (error) {
      console.error('Error occurred while loading the latest measurement: ', error);
    }
  }

```

I suppose my main question is where do I get correct fragment and series names from my own templates to use with my own version of the `loadLatestMeasurement` method?

---

<div class="post-metadata">

**Author:** ![Korbinian\_Butz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/korbinian_butz/32/10473_2.png) [@Korbinian\_Butz](https://community.cumulocity.com/u/Korbinian_Butz)\
**Post date:** [August 28, 2023, 9:52pm UTC](https://community.cumulocity.com/t/where-do-i-get-the-fragment-and-series-names-for-methods-relying-on-the-web-sdk/4312/2 "2023-08-28T21:52:18Z")

</div>

Hi Lucas,

was this template already used and you have such measurements in your tenant?

In general, measurements are following a specific structure that foresees each measurement value to be embedded within a fragment and a series (often the fragment is being used for classification purposes and the series as measurement-name).  
In this example "c8y\_Steam is the `fragment`, “Temperature” the `series` and “c8y\_TemperatureMeasurement” the `type`:

```json
{
  "source": {
    "id": "251982"
  },
  "time": "2020-03-19T12:03:27.845Z",
  "type": "c8y_TemperatureMeasurement",
  "c8y_Steam": {
    "Temperature": {
      "unit": "C",
      "value": 100
    }
  }
}

```

You’ll need to have `1..n` fragments with `1..n` series per fragment in your measurement. Each series needs to contain exactly one `value` attribute. See measurement-design in this [domain model article](https://community.cumulocity.com/t/the-cumulocity-iot-domain-model-how-to-design-a-good-domain-model/1487#measurement-design-11) for more info.

If you have produced these measurements already:  
Use [this](https://cumulocity.com/api/core/10.16.0/#operation/getMeasurementCollectionResource) API Endpoint to query your devices measurements. `GET /measurement/measurements?source={your device id}` should reveal the structure how your measurements are stored - including the fragments/series names. You can import the openApi spec to any REST Client (e.g. Postman) to do these queries. From your screenshot I would expect fragmentName is “mode” and series “bariatric”.

Another REST Endpoint that might be of interest is this one to [retrieve all supported measurement fragments and series of a Managed Object](https://cumulocity.com/api/core/10.16.0/#operation/getSupportedSeriesManagedObjectResource)

---

<div class="post-metadata">

**Author:** ![luclib](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@luclib](https://community.cumulocity.com/u/luclib)\
**Post date:** [August 29, 2023, 2:23pm UTC](https://community.cumulocity.com/t/where-do-i-get-the-fragment-and-series-names-for-methods-relying-on-the-web-sdk/4312/3 "2023-08-29T14:23:15Z")

</div>

Hi Korbinian,

The measurements and devices were both registered using an MQTT protocol to send data to Cumulocity. In terms of the SmartTemplate, those were registered later by someone else from my team.

Regardless, I am able to visualize the structures in my browser using the Dev Tools. Here’s a snapshot of one such structure:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/3/0/30d9653eb00b02a037ae455bdcef05b1b295caed.png)

Based on your reply, would `tubeSet` be the `fragment`, `smokeEvacuationHighFlow` be the series, and `tubeSet` be again the `type`?

Cheers,

Lucas L.

---

<div class="post-metadata">

**Author:** ![Korbinian\_Butz](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/korbinian_butz/32/10473_2.png) [@Korbinian\_Butz](https://community.cumulocity.com/u/Korbinian_Butz)\
**Post date:** [August 29, 2023, 2:35pm UTC](https://community.cumulocity.com/t/where-do-i-get-the-fragment-and-series-names-for-methods-relying-on-the-web-sdk/4312/4 "2023-08-29T14:35:51Z")

</div>

> [@luclib](#):
>
> Based on your reply, would `tubeSet` be the `fragment`, `smokeEvacuationHighFlow` be the series, and `tubeSet` be again the `type`?

Yes, correct.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [February 25, 2024, 2:36pm UTC](https://community.cumulocity.com/t/where-do-i-get-the-fragment-and-series-names-for-methods-relying-on-the-web-sdk/4312/5 "2024-02-25T14:36:18Z")

</div>

Closed on February 25, 2024, 2:36pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
