Welcome Lee,

It has been a while since I used the API, but I think that the API that you are 
looking for is constructResourceObject(). I am at the OIC Member?s meeting this 
week and do not have my development laptop with me. Grep the samples and see if 
we have one that uses the API. If we do not have a sample the demonstrates your 
need, we should add one. Let me know if you need additional help and I or one 
of the other contributor?s will close the gap in the SDK samples and/or 
documentation.

Pat Lankswert

Maintainer

From: iotivity-dev-bounces at lists.iotivity.org 
[mailto:[email protected]] On Behalf Of MinChul Lee
Sent: Wednesday, February 25, 2015 5:05 AM
To: iotivity-dev at lists.iotivity.org
Subject: [dev] RESTfully, request scenario of IoTivity



Dear all,

Hello. I have an issue to discuss about request of client.



As I haved examined about REST API, one scenario could be present as below.

(If you see some sample codes of /resources/examples/, you could understand 
easily.)




(Server name is "A" and it can handle new notifications received. Client name 
is "B".)



"A" creates a resource "/notifications/" and it is <collection> of REST. ==> 
OCPlatform::registerResource("A");

"B" finds a collection URI "/notifications/" and it is founded successfully. 
==> OCPlatform::findResource("rt=foo");

"A" creates new noti resource "/notifications/1" and it is <document> of REST. 
==> OCPlatform::registerResource("B");



At this time, "B" already has a OCResource instance of "/notifications/" after 
OCPlatform::findResource("rt=foo") called.

"B" want to receive the new notification "/notifications/1". But, "B" can't 
trigger a request like "GET /notifications/1"

Because "B" can only  use resource->get() function defined in OCResource.h file 
and it doesn't have a function to set new URI "/notifications/1/".

(It only has a getter "std::string uri() const" in the OCResource.h but setter.)



This could be solved by  adding a setter "void setUri(std:string& str)" in 
OCResource.h. But, it is not exist now.

Because I think IoT world doesn't need to think about "Request about not found 
Things.".



There would be 1~N new notifications in the "A" device.

And "A" can say (notify using Observe) "Hello, device B. I have 30 new 
notifications. What number do you want?"

Not only notifications, but user might wanted to trigger requests for new 
informations as below :


#request

GET /alerts/



#response

/alerts/ have links as below :

- resend : /alerts/resend

- sort : /alerts/sort



# request

POST /alerts/resend



In short, 

- Is there a good idea (APIs) to deal this scenario?

- Is it possible to add "setUri" in OCResource.h? And does it go counter to the 
rules of REST, IoTivity, CoAp etc?



I want to hear advice from you all to implement this scenario based on IoTivity 
and REST API.



Best regards,

Lee.







  
<http://ext.samsung.net/mailcheck/SeenTimeChecker?do=0966c73de79aa04622422c1b083a070036d042cac4cd0092a136cf3908ce27e8be7dd83ce6b932973c40f787d33f357d4b31597edd603a7ce5a22f09e2218feaa728c55b39cc59eacf878f9a26ce15a0>
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150225/1b951b51/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 13168 bytes
Desc: not available
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150225/1b951b51/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 7198 bytes
Desc: not available
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150225/1b951b51/attachment.p7s>

Reply via email to