[xwiki-users] RESTful API Issue
Hi All, I'm using RESTful API, I'm trying to create Xwiki Object and attach to existing document using /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects POST method Object customObject = new Object(); customObject.setClassName("XWiki.MyCustomClass"); Property property = new Property(); property.setType("com.xpn.xwiki.objects.classes.StringClass"); property.setName("RefTags"); property.setValue("Food"); customObject.withProperties(property); ClientResponse response = resource.accept("application/xml").post(ClientResponse.class, customObject); int httpResponseCode = response.getStatus(); Object resObj = response.getEntity(Object.class); Problem is Class's Object gets attached to document but properties aren't. I even tried url encode format found property#name=value Please help / suggest solution. Thanks in advance, Aslam Sayyed
Some more info on this issue Class: XWiki.MyCustomClass exists in default wiki "XWiki". But I'm Trying to add object as shown below in another wiki (say virtualwiki1). On Mon, Apr 9, 2012 at 10:17 PM, Aslam Sayyed <[email protected]>wrote:
Hi All, I'm using RESTful API, I'm trying to create Xwiki Object and attach to existing document using /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects POST method Object customObject = new Object(); customObject.setClassName("XWiki.MyCustomClass"); Property property = new Property(); property.setType("com.xpn.xwiki.objects.classes.StringClass"); property.setName("RefTags"); property.setValue("Food"); customObject.withProperties(property); ClientResponse response =
resource.accept("application/xml").post(ClientResponse.class, customObject); int httpResponseCode = response.getStatus(); Object resObj = response.getEntity(Object.class);
Problem is Class's Object gets attached to document but properties aren't.
I even tried url encode format found property#name=value
Please help / suggest solution. Thanks in advance, Aslam Sayyed
On Tue, Apr 10, 2012 at 3:21 PM, Aslam Sayyed <[email protected]> wrote:
Some more info on this issue
Class: XWiki.MyCustomClass exists in default wiki "XWiki". But I'm Trying to add object as shown below in another wiki (say virtualwiki1).
Currently you can't add objects of a type/class defined in a different wiki. In other words, the class reference (Space.ClassName) is always relative to the wiki where you add the object. So the code that adds the object looks for XWiki.MyCustomClass in virtualwiki1. You need to copy/move the class there. Hope this helps, Marius
On Mon, Apr 9, 2012 at 10:17 PM, Aslam Sayyed <[email protected]>wrote:
Hi All, I'm using RESTful API, I'm trying to create Xwiki Object and attach to existing document using /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects POST method Object customObject = new Object(); customObject.setClassName("XWiki.MyCustomClass"); Property property = new Property(); property.setType("com.xpn.xwiki.objects.classes.StringClass"); property.setName("RefTags"); property.setValue("Food"); customObject.withProperties(property); ClientResponse response =
resource.accept("application/xml").post(ClientResponse.class, customObject); int httpResponseCode = response.getStatus(); Object resObj = response.getEntity(Object.class);
Problem is Class's Object gets attached to document but properties aren't.
I even tried url encode format found property#name=value
Please help / suggest solution. Thanks in advance, Aslam Sayyed
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Thanks a lot Mauris. In our current implementation, we consume virtual wikis only through REST api and we have extended it to add few functionalities as we needed. As per your comment, I'm thinking to export existing class definition to xar / xml and import it to other virtual wiki. Can I copy/create class definition programatically to other virtual wiki. Pointer to XWiki API / plugin / class reference will be helpful. Thanks again. Regards, Aslam Sayyed On Mon, Apr 9, 2012 at 10:17 PM, Aslam Sayyed <[email protected]>wrote:
Hi All, I'm using RESTful API, I'm trying to create Xwiki Object and attach to existing document using /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects POST method Object customObject = new Object(); customObject.setClassName("XWiki.MyCustomClass"); Property property = new Property(); property.setType("com.xpn.xwiki.objects.classes.StringClass"); property.setName("RefTags"); property.setValue("Food"); customObject.withProperties(property); ClientResponse response =
resource.accept("application/xml").post(ClientResponse.class, customObject); int httpResponseCode = response.getStatus(); Object resObj = response.getEntity(Object.class);
Problem is Class's Object gets attached to document but properties aren't.
I even tried url encode format found property#name=value
Please help / suggest solution. Thanks in advance, Aslam Sayyed
On Tue, Apr 10, 2012 at 7:18 PM, Aslam Sayyed <[email protected]> wrote:
Thanks a lot Mauris. In our current implementation, we consume virtual wikis only through REST api and we have extended it to add few functionalities as we needed.
As per your comment, I'm thinking to export existing class definition to xar / xml and import it to other virtual wiki.
This should work just fine.
Can I copy/create class definition programatically to other virtual wiki. Pointer to XWiki API / plugin / class reference will be helpful.
See https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwik... and http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org... but I think you are interested in a REST API and I believe there is one recently added (not sure it works cross wiki though). I'll let Fabio/Edy give you more details. Hope this helps, Marius
Thanks again. Regards, Aslam Sayyed
On Mon, Apr 9, 2012 at 10:17 PM, Aslam Sayyed <[email protected]>wrote:
Hi All, I'm using RESTful API, I'm trying to create Xwiki Object and attach to existing document using /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects POST method Object customObject = new Object(); customObject.setClassName("XWiki.MyCustomClass"); Property property = new Property(); property.setType("com.xpn.xwiki.objects.classes.StringClass"); property.setName("RefTags"); property.setValue("Food"); customObject.withProperties(property); ClientResponse response =
resource.accept("application/xml").post(ClientResponse.class, customObject); int httpResponseCode = response.getStatus(); Object resObj = response.getEntity(Object.class);
Problem is Class's Object gets attached to document but properties aren't.
I even tried url encode format found property#name=value
Please help / suggest solution. Thanks in advance, Aslam Sayyed
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (2)
-
Aslam Sayyed -
Marius Dumitru Florea