Hi Phil,

I'm not sure exactly what's wrong with what you're doing but here is two
thought that may help you.

1)  First, you say that "New VersionInformationClass instances I'm
creating wind up in the tree under [Home Symbol] / Software Development
/ Resources / Version Information." so I would expect a URI of the
following form

http://localhost/xwiki/rest/wikis/xwiki/spaces/Software
Development/spaces/Resources/spaces/Version
Information/pages/VersionInformation/objects

2) I see that you put spaces (the character ' ') in some of the spaces
name (wiki's nested spaces).  It should be possible to make it work with
spaces (character) but I'm not sure about the syntax in this case (maybe
a '+' to replace ' ', maybe something else).  You may want to test
without first to see if the problem come from this character or not?

Hope this helps,

Sincerely,

On 01/03/2016 14:42, pgregoire wrote:
> Hello,
> I read through this thread, and being a newbie to XWiki, I do understand the
> cURL syntax explained here, but it's the location of wikis/pages/classes I'm
> unsure about.
> 
> I created a custom class of which I'm able to instanciate objects, and list
> them using a LiveTable.
> The className I'm using in the LiveTable options is
> "Development.Resources.Version Information.VersionInformationClass".
> New VersionInformationClass instances I'm creating wind up in the tree under
> [Home Symbol] / Software Development / Resources / Version Information.
> 
> I'd like to create new instances of that class using cURL.
> I think the following syntax would look about right:
> 
> "C:\Program Files\cURL\bin\curl.exe" -u AdminUser:AdminPassword -X POST -H
> "Content-type: application/x-www-form-urlencoded" -H "Accept:
> application/xml" -d "className=Development.Resources.Version
> Information.VersionInformationClass" -d "property#Name=TestABCD"
> http://localhost/xwiki/rest/wikis/xwiki/spaces/Development/pages/VersionInformation/objects
> 
> Now I have many more properties than just Name, but for testing I figured
> I'd start just with that one.
> The className I'm pretty sure about since this is exactly what I'm
> successfully using in my LiveTable.
> I think the problem is my URI. I'm not sure what the wiki, space and class
> should be in that context.
> 
> I get the following output:
> <html>
> <head>
>    <title>Status page</title>
> </head>
> <body style="font-family: sans-serif;">
> <p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Not Found</p>
> <p>The server has not found anything matching the request URI</p>
> <p>You can get technical details  here
> <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5>  .<br>
> Please continue your visit at our  home page </>  .
> </p>
> </body>
> </html>
> 
> Can someone help me figure out the correct URI?
> 
> Thank you
> Phil
> 
> 
> 
> 
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/RESTful-API-to-create-a-new-object-of-custom-class-tp6965384p7598184.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 

-- 
Jean Simard
jean.sim...@xwiki.com
Research engineer at XWiki SAS
http://www.xwiki.com
Committer on the XWiki.org project
http://www.xwiki.org
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to