Re: [xwiki-users] How to add a page with contents in xwiki through Rest api???

2010-06-22 Thread xManish

I think I will have to apologize the original creator of this thread for
using it to discuss my issue. 
Jerome, could you please join me in the another thread that I've created for
this issue.
Its 'Create User in XWiki from REST Api' under XWiki-Dev.

THankyou,
manish
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/How-to-add-a-page-with-contents-in-xwiki-through-Rest-api-tp4520594p5211253.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


Re: [xwiki-users] How to add a page with contents in xwiki through Rest api???

2010-06-21 Thread xManish

I might really have to apologize to the main creator of this thread for using
the thread.
Jerome, I'll start a new thread on this topic. Adding user through Rest
Api. Would you please join me there?


-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/How-to-add-a-page-with-contents-in-xwiki-through-Rest-api-tp4520594p5206169.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


Re: [xwiki-users] How to add a page with contents in xwiki through Rest api???

2010-06-21 Thread xManish

Hi Jerome,
Ya of course having /wikis/{wikiName}/users would have been nice. :)
But coming to reality, I still have the problem creating user.
Here is the code on how I created the wiki page. 
Can you advise me how to create the wiki user in the similiear manner?

public void myAddMethod()
{
final String CONTENT = Content 101;
final String TITLE = Title 101;
final String PARENT = Private.WebHome;

ObjectFactory objectFactory = new ObjectFactory();
Page page = objectFactory.createPage();
page.setContent(CONTENT);
page.setTitle(TITLE);
page.setParent(PARENT);
HttpClient httpClient = new HttpClient();
httpClient.getState().setCredentials(AuthScope.ANY, new
UsernamePasswordCredentials(admin, admin));
httpClient.getParams().setAuthenticationPreemptive(true);
JAXBContext context;

try {
context = JAXBContext.newInstance(org.xwiki.rest.model.jaxb);
Marshaller marshaller = context.createMarshaller();
Unmarshaller unmarshaller = context.createUnmarshaller();

PutMethod putMethod = new
PutMethod(http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Private/pages/NewPage01;);
putMethod.addRequestHeader(Accept,
MediaType.APPLICATION_XML.toString());

StringWriter writer = new StringWriter();
marshaller.marshal(page, writer);

RequestEntity entity;
entity = new StringRequestEntity(writer.toString(),
MediaType.APPLICATION_XML.toString(), UTF-8);
putMethod.setRequestEntity(entity);

httpClient.executeMethod(putMethod);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/How-to-add-a-page-with-contents-in-xwiki-through-Rest-api-tp4520594p5206709.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


Re: [xwiki-users] How to add a page with contents in xwiki through Rest api???

2010-06-17 Thread xManish


Jerome Velociter wrote:
 
 Hi Nithya, Manish
 
 Have you checked
 http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI#HPageresources
 ?
 
 In particular :
 
 /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}
 HTTP Method: PUT
 * Accepted Media types:
   o application/xml (Page element)
   o text/plain (Only page content)
   o application/x-www-form-urlencoded (allowed field names: title,
 parent, content)
 
 Is something not clear about it ? Not working ?
 
 Thanks,
 Jerome
 
 

Hi Jerome,
Thanks for the reply. I was able to create the page afterwards. Sorry for
the impatience :)
However, today I am into different but similiar situation. I need to create
users in XWiki through REST Api.
Is it possible? How to do it?

Thanks,
Manish
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/How-to-add-a-page-with-contents-in-xwiki-through-Rest-api-tp4520594p5192646.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


Re: [xwiki-users] How to add a page with contents in xwiki through Rest api???

2010-06-17 Thread Jerome Velociter
Hi.

See below

- xManish shresthaman...@gmail.com wrote:

 Jerome Velociter wrote:
  
  Hi Nithya, Manish
  
  Have you checked
 
 http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI#HPageresources
  ?
  
  In particular :
  
  /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}
  HTTP Method: PUT
  * Accepted Media types:
o application/xml (Page element)
o text/plain (Only page content)
o application/x-www-form-urlencoded (allowed field names:
 title,
  parent, content)
  
  Is something not clear about it ? Not working ?
  
  Thanks,
  Jerome
  
  
 
 Hi Jerome,
 Thanks for the reply. I was able to create the page afterwards. Sorry
 for
 the impatience :)

Sorry if my message felt harsh, that was not the intend :)

 However, today I am into different but similiar situation. I need to
 create
 users in XWiki through REST Api.
 Is it possible? How to do it?

Currently, I'm not sure you can perform this as an atomic operation. 
Unless maybe your wiki runs with the implicit XWikiAllGroup setting (see 
http://jira.xwiki.org/jira/browse/XWIKI-2116 )

What you have to do is then use the object REST api ( 
http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI#HObjectresources
 ), creating a page with an object of class XWiki.XWikiUsers
If you don't have the implicit XWikiAllGroup then you need to add an object of 
class XWiki.XWikiGroups with the created user as member, to XWiki.XWikiAllGroup 
document.

I agree an API to directly hit and create users, under /wikis/{wikiName}/users 
would be nice.

Regards,
Jerome.

 
 Thanks,
 Manish
 -- 
 View this message in context:
 http://xwiki.475771.n2.nabble.com/How-to-add-a-page-with-contents-in-xwiki-through-Rest-api-tp4520594p5192646.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
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] How to add a page with contents in xwiki through Rest api???

2010-06-16 Thread xManish


Nithya Vembu wrote:
 
 But i dont getting clear idea, how can i create a page under space with
 some contents.. and i am not getting any good samples for xwiki rest api.
 
 ...
 
  Kindly anyone give me idea how rest will get differentiate in xwiki
 manner..
 
  Can anyone give me a code snippet for this requirement so that i can
 improve my progress in my project..
 
  Any help greatly appreciated.
 
  Thanks in advance.
 
 Regards,
 Nithya.
 

Hi,
Did you happened to find the solution to your problem? 
If yes, would you please share it.

Thanks,
Manish
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/How-to-add-a-page-with-contents-in-xwiki-through-Rest-api-tp4520594p5188695.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