Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » OM2M » Use REST client to change the attribute of Container
Use REST client to change the attribute of Container [message #1741779] Mon, 29 August 2016 13:21 Go to next message
Can LIU is currently offline Can LIUFriend
Messages: 29
Registered: May 2016
Junior Member
Hey guys,

I hava a very stupide question. Sad
Can I use REST client to change the attribute of Container?
If yes, how can i edit the POST request body?
For example this is my interface and my DESCRIPTOR Container,
If i want to change the attirbute "mia" from 0 to 1.
index.php/fa/26908/0/
And how to edit de REST POST request body?
index.php/fa/26909/0/

Thanks in advance !

Can

[Updated on: Mon, 29 August 2016 13:22]

Report message to a moderator

Re: Use REST client to change the attribute of Container [message #1741897 is a reply to message #1741779] Tue, 30 August 2016 13:55 Go to previous messageGo to next message
Dorian Kurzaj is currently offline Dorian KurzajFriend
Messages: 16
Registered: May 2016
Junior Member
Hi,
I am not sure I understood really well what you were trying to do with your example request, but if you want to change the value of mia to 1 using the REST API, you could do something like that:

URL: http://IPaddresse:8282/~/mn-cse/mn-name/MY_GPS/DESCRIPTOR
Method: PUT
Headers: X-M2M-Origin: admin:admin
Body:
<m2m:csr xmlns:m2m="http://www.onem2m.org/xml/protocols">
<mia>1</mia>
</m2m:csr>

Hope it helps !

Regards,
Dorian
Re: Use REST client to change the attribute of Container [message #1741901 is a reply to message #1741897] Tue, 30 August 2016 14:06 Go to previous message
Francois AissaouiFriend
Messages: 38
Registered: April 2015
Member
Hi Can,

To update a resource you have to make a PUT http operation targeting the resource you want to update.
The payload has to be the representation of the attributes you want to change.

In your case, to update the "mia" attribute of a container, the request is:
PUT /~/in-cse/in-name/{YOUR_CONTAINER_LOCATION} HTTP/1.1
Host: localhost:8080
Content-Type: application/xml
X-M2M-Origin: admin:admin
X-M2M-RI: 123456

<?xml version="1.0" encoding="UTF-8"?>
<m2m:cnt xmlns:m2m="http://www.onem2m.org/xml/protocols" >
   <mia>1</mia>
</m2m:cnt>


Regards,
François
Previous Topic:responseStatusCode=5204, error when create subscription of IN data to MN(solved)
Next Topic:Router internal error when running in-cse
Goto Forum:
  


Current Time: Mon Sep 24 08:03:35 GMT 2018

Powered by FUDForum. Page generated in 0.02136 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top