On 06/24/2010 04:25 PM, xManish wrote: > > > Marius Dumitru Florea wrote: >> >> >> All this personal information is stored in the XWiki.XWikiUsers object. >> Go to your profile page, edit with the object editor and expand the >> XWiki.XWikiUsers object. You'll see a lot of properties. I'm sure there >> is a way to set those properties using the REST Api. >> >> Hope this helps, >> Marius >> > > Hi Marius, > Thanks for the reply. > I checked it out and I can saw those properties. I too believe there is a > way to set those properties. I went through the Restful API documentation at > http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI > and tried to set the property like below > ..... > PutMethod putMethod = new > PutMethod("http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWikiUsers/0/properties/first_name=MyName"); > putMethod.addRequestHeader("Accept", > MediaType.APPLICATION_XML.toString()); > httpClient.executeMethod(putMethod); > ...... > Can somebody find anything wrong here? Am I missing some point? > First. The resource "http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWikiUsers/0/properties/first_name=MyName" is not correct. Here it seems that you are using URIs as if they were variable names!
The resource should be "http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWikiUsers/0/properties/first_name" The value will be given through the PUT request body, that you didn't initialize in your code. Using curl, for example you would have done something like this: $ curl -v -u Admin:admin -X PUT -H "Content-type: text/plain" --data-ascii "Real User01 Name" http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/XWiki/pages/user01/objects/XWiki.XWikiUsers/0/properties/first_name To see how this is translated in Java you can hava a look at the functional tests for the REST Api. You can find them here: http://svn.xwiki.org/svnroot/xwiki/enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/rest/it/ And in particular, for objects and properties you can have a look at: http://svn.xwiki.org/svnroot/xwiki/enterprise/trunk/distribution-test/rest-tests/src/test/it/org/xwiki/rest/it/ObjectsResourceTest.java Hope it helps, Fabio _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
