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/objec..."); 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/objec..." 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/objec..." 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/objec... 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-t... And in particular, for objects and properties you can have a look at: http://svn.xwiki.org/svnroot/xwiki/enterprise/trunk/distribution-test/rest-t... Hope it helps, Fabio