1

I am using libcoap implementation of CoAP for one of my IOT application.

Query: I want to group more than one resource under one topic. For example, I want to group 'current time' resource and 'date' resource under 'TIME' resource.

On GET request to '/TIME' resource, server should provide date and current time to client. On GET request to '/TIME/current time' resource, server should provide current time to client. On GET request to '/TIME/date' resource, server should provide today's date to client.

Also, I am using Firefox Copper plugin to test my iot server application.

Richard Chambers
  • 16,643
  • 4
  • 81
  • 106

1 Answers1

0

Assuming you have created both the /TIME/currenttime and /TIME/date resources, what's left is that you create a /TIME/ resource (the slash at the end does matter) and announce it in .well-known/core as </TIME/>;if="core.b".

The GET handler for /TIME/ should return data in application/senml+json format, like [{"n":"currenttime","sv":"10:40:25"},{"n":"date","sv":"2018-07-27"}].

All the details are described in core-interfaces draft, but that's the gist of it.

Community
  • 1
  • 1
chrysn
  • 810
  • 6
  • 19
  • This usage of SenML was obsoleted by late clarifications to the specification. core-interfaces has not been updated to reflect that, and its future is unclear. You can still build such a service, but you should respond with the full URI in the "n" field. – chrysn Mar 31 '20 at 10:58