Looking for help sending queries to LwM2M devices via the Open API

What product/components do you use and which version/fix level?

Cumulocity IOT specifically LWM2M
Version: 1011.0.12

Are you using a free trial or a product with a customer license?

Product with a customer license

What are trying to achieve? Please describe in detail.

I am attempting send queries and receive responses from my LwM2M devices registered with cumulocity by using the public API.
Specifically, I would like to perform operations such as “READ 1/0/1” “WRITE 3/0/3” etc
These operations are available from the “Shell” sidebar link when selecting an LwM2M device in my account, but I need to be able to do this in an automated fashion for my testing.

I am aware of the interactive
cumulocity API browser
(Forum will not allow me to link to a cumulocity page?!)
But I see nothing there that supports sending requests I am currently using the shell (manually) for.

Do you get any error messages? Please provide a full error message screenshot and log file.

N/A since I haven’t been able to find the correct API yet

Hi Jim,

if I understood you correctly you want to send Shell commands automatically using the API. Shell commands itself are just Cumulocity Operations using a specific structure. An example for Shell command looks like this:

{
  "deviceId": "3100", // the device id for which you want to send the shell command
  "description": "Execute shell command", // description
  "c8y_Command": { // the c8y_Command fragment to identify this operation as a shell command
    "text": "12" // the actual command you want to send to your device
  }
}

Depending on the messages you want to send, you can simply replace the content of the text property within the operation.

As a general tip, you can use the Developer Tools of your browser to perform some basic reverse engineering how the Cumulocity UI communicates with the REST API. Simply open the Network tab of Developer tools and monitor the requests being sent by the platform. If you trigger for example a shell command from the UI, you will see that a new operation with the specified command has been created:

Best regards
Christian

Hi,
I took your advice and used the chrome developer console to view the transactions my browser was submitting from the web console.

Turns out - there is a really handy feature I never knew about - where you can copy the network transaction as curl - and then I simply pasted it into a curl-2-python conversion page which allowed me to easily add it to my python automation tests.

I really wish I could have figured out their documentation - but doing it this way is actually much easier.

thanks for the suggestion!

Jim