Search code examples
onem2m

How to create attribute in flexcontainer in oneM2M?


I am trying to create attribute in flexcontainer in oneM2M, i have created container and contentinstance in oneM2M. Now I need to use flexcontainer.


Solution

  • I guess from your question that you try to directly create a <flexContainer> resource. That is not possible. The <flexContainer> can be viewed as an "abstract base class" that needs to be further specified. In oneM2M these derived resource types are called specialisations. A specialisation takes all the resource specific attributes from the <flexContainer> and adds the custom attributes that actually represent the functional part. This specialisation can now be created, retrieved etc like any other resource.

    Take, for example, the clock specialisation that is defined in oneM2M's TS-0023 document. It adds three new custom attributes, namely currentTime, currentDate, and currentTimeZone in order to represent a clock functionality.

    Please note that the CSE implementation you are using needs to support the <flexContainer> resource type in general, and the specific specialisations you want to use. If you want to create your own specialisations then the CSE must support user-defined specialisations and their validations as well.

    The oneM2M specifications are available here: https://www.onem2m.org/technical/published-specifications