On Tue, Mar 12, 2013 at 7:08 PM, zacharykane <[email protected]> wrote:
> Well I think I figured out what wasn't working.. Here's what I'm trying to do
> with a "thin client" JavaScript application.
>
> var create = 'https://domain/xwiki/rest/wikis/XWiki/spaces/Main/pages/' +
> reportType + ' – ' + reportDate + 'T' + reportTime + 'P' + reportPeriod +
> '?method=PUT';
>
> httpRequest.open('POST', create);
> httpRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
> httpRequest.send('title=' + reportType + ' – ' + reportDate + 'T' +
> reportTime + 'P' + reportPeriod + '&content=' + reportType + ' – ' +
> reportDate + 'T' + reportTime + 'P' + reportPeriod +
> '&parent=Main.WebHome');
>
I don't know why are you complicating things like this...
You can direcly du a PUT request instead of doing a POST to an URI
saying that actually it's a PUT :)

> What I've discovered is that I want my Page created based upon a template,
> that exists already. So I want to add &template=Main.MyTemplate to the
> request which doesn't seem to be allowed. If I view Document Index
> (/AllDocs) of my wiki I see that the page is listed but has no Last Author,
> which I thought was weird.
>
> So leaving that off and creating the Page with only the bare necessities, it
> works however I cannot now specify the &template query param on the /edit/
> URL to open the document with a template, since it already exists with
> content. So is there a way to create a page in this way with a template for
> content?
>
The REST page resource doesn't accept  any parameter called template.
/edit URIs are a total different things with respect to the REST API URIs.

-Fabio


>
>
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/RESTful-Create-Page-doesn-t-exist-tp7584185p7584244.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