Hi,

you can just sent a PUT request to the following URI:
/rest/wikis/YOURWIKI/spaces/THE_SPACE_WHERE_YOU_WANT_TO_CREATE_THE_PAGE/pages/THE_NAME_OF_THE_PAGE_YOU_WANT_TO_CREATE

the body should be either an XML that follows the schema defined for
the Page element here:
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-model/src/main/resources/xwiki.rest.model.xsd#L122
or a an application/x-www-form-urlencoded containing the relevant
fields.

The relevant fields that are taken into account are: title, content,
syntax, parent.

To be more clear suppose you want to create a page Foo in the Main space.

You need to create an XML document like this:

<page xmlns="http://www.xwiki.org";>
<title>Foo</title>
<content>
  I am foo!
</content>
</page>

and send it, for example, by using curl:

curl -u Admin:admin -H "Content-type: application/xml" -X PUT -d
"@thefilecontainingthexmldocument.xml"
http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/Foo

Alternatively you can send application/x-www-form-urlencoded by
specifying several -d parameters:

curl -u Admin:admin -X PUT -d "content=this is Foo" -d "title=Foo"
http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/Foo

Of course the same can be achieved by writing some Java code and using
HttpClient, or in any programming language or scripting language that
has an HTTP library.
Finally, it's just HTTP

Hope this helps,
Fabio

On Fri, Mar 8, 2013 at 3:40 PM, zacharykane <[email protected]> wrote:
> Possibly, I don't think a version offset would matter.
>
> How do you save a page with the REST api? Modify it with the PUT method?
>
>
>
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/RESTful-Create-Page-doesn-t-exist-tp7584185p7584205.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to