Search code examples
pythononem2monem2m-device-management

How to create resource/ send request to create resource in ACME oneM2M in REST UI?


I am learning about ACME oneM2M framework, am a new to it. I am trying to create a web dashboard, through which I would be able to control LED light. This web dashboard can have buttons ON and OFF, trying to create this through ACME. Please help me how can I do it, how can I send request to create resource in ACME REST UI?


Solution

  • Author of ACME CSE here.

    The ACME CSE is an implementation of a oneM2M CSE (Common Services Entity). It supports the http and MQTT bindings for creating, retrieving, updating, and deleting of resources in a oneM2M resource tree. This means you may send requests like the following one to the CSE (using curl):

    curl -X GET -H 'X-M2M-Origin:CAdmin' -H 'X-M2M-RI:123' -H 'X-M2M-RVI:3' -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/cse-in
    

    That request would retrieve the <CSEBase> resource from a CSE running locally at port 8080. Every request needs a couple of mandatory headers and (for CREATE and UPDATE) a body with a resource definition.

    If you have no experience with oneM2M then you should have a look at the specifications TS-0001 (Architecture), TS-0004 (Protocol) and TS-0009 (http binding) first (see oneM2M specifications). The "Develop with oneM2M" section on that website provides a good starting point to get a technical overview.

    A hands-on tutorial that introduces you to a couple of basic oneM2M concepts is available in the form of Jupiter Notebooks at oneM2M's GitHub repository (disclaimer: I am the author of these tutorial as well). You can download the tutorial, or run the notebooks directly on mybinder.org without any installation efforts.
    The tutorial comes with its own installation of the ACME CSE running in a separate notebook online. There are notebooks that will show you how to register your application, and how to work with data containers. For each request the corresponding curl request is shown as well, which then might be good starting point for your own oneM2M application.