Hello,
i like the REST-API and have a library in Java which works perfect. Now i
want to use the RESTful API in Javascript. But i am new to javascript and
tried a lot, but nothing seems to work. Is there a simple example in
javascript with the rest-api?
I don't get what i am doing wrong, because i am not good in javascript.
I tried
require(['jquery'], function ($) {
$.ajax({
accepts: {xml: 'text/xml', text: 'text/plain'},
url: 'http://HOST/xwiki/rest',
type: 'GET',
dataType: 'xml',
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
converters: {'text xml': jQuery.parseXML},
crossDomain: true,
async: true,
username: 'username',
password: 'apassword',
success: function(data){
alert("Success: "+JSON.stringify(data));
},
error: function(data){
alert("Error: "+ JSON.stringify(data));
}
});
});
Also i tried
var httpRequest = new XMLHttpRequest();
httpRequest.open('PUT', 'http://HOST/xwiki/rest');
httpRequest.setRequestHeader('Accept', 'application/xml');
httpRequest.send( null );
alert( JSON.stringify(httpRequest.responseText) );
httpRequest.onreadystatechange = function(){
if(this.readyState == 4){
if(this.status == 200){
alert(this.responseText);
}
else{
alert(this.statusText);
}
}
}
I recognized a difference in ajax when i switched to jsonp because i tried
on localhost. But anyway my example work when i use my server outside.
Can you help me?
Regards,
Matthias
--
View this message in context: http://xwiki.475771.n2.nabble.com/Javascript-RESTful-tp7594084.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
I'd like to be able to generate pure JSON from a wiki page, to use in other pages via AJAX. To that end I created a page with the following content:
{{velocity wiki="false"}}
$response.setContentType('application/json')
{
"greeting" : "Hello",
"location": "World"
}
{{/velocity}}
Calling this via /xwiki/bin/get/Sandbox/JsonTest I get the following code:
<p><br/>{<br/>"greeting" : "Hello",<br/>"location": "World"<br/>}</p>
I get the same via /xwiki/bin/view/AlertDB/JsonTest?xpage=plain.
If I remove the $response.setContentType('application/json')
https://dev.alertnessdb.net/xwiki/bin/view/AlertDB/JsonTest?xpage=plain
Currently, I'm using something like this to generate a list of pages whose
prefix is "Prefix:" and link to them:
{velocity}} (((
#foreach ($row in $services.query.hql("select doc.name, doc.fullName from
XWikiDocument doc where doc.space.hidden = false and doc.space not in
('XWiki', 'Sandbox', 'Main', 'Macros') and doc.name like
'Prefix:%'").execute())
* **[[$row[0].replaceFirst("Prefix: *", "").replaceAll("~",
"~~~~").replaceAll("[\x20-\x7f&&[^a-zA-Z0-9 ~]]",
"~~$0")>>doc:$row[1].replaceAll("~", "~~").replaceAll("[\x5b\x5d|]", "\\$0
<file:///\\$0> ")]]**
#end
))) {{/velocity}}
I have tested with some heavy test cases like
Prefix:
~~~!!!```@@@$$$%%%^^^&&&***((()))___----+++==={{{}}}[[[]]]\\\|||:::;;;'''"""
???///...>>>,,,<<<
And what I have above works correctly (both showing the title and linking to
the document). I only work on a few hard test cases, though, so I'm not sure
if I missed anything.
Is there a method that does all this automatically? Or is there a better
approach to this?
I have a Groovy script that takes input from a form textarea. I'd like to prevent html (and JS) markup from being submitted and, if HTML is submitted, strip it out. Is there a tool already packaged within XWiki to do this, or should I look to an external package like Jericho?
Thanks,
Bryn
Seem to have vanished, is there as way to bring them back ?
I'm loving the copy and paste from Excel to create a table, but I
would love to see the cell borders, it makes it much easier when
navigating a larger table.
Cheers
Hi,
It looks like that we can not use the macro AVATAR in a wiki on this farm?
{{useravatar username="<username>" /}}
Then I added the extension:
{{userprofile username="XWiki.Admin" /}}
But both give error: unknown user?
Gerritjan
Hi,
i want to read, edit and save xwiki-objects from a page in javascript. I
wrote a post
(http://xwiki.475771.n2.nabble.com/Javascript-RESTful-tp7594084.html) where
i thought i should solve this with rest. I think now is is a lack of
knowledge. Where is documented what the Object 'XWiki' in javascript can do?
I read some source-code from fullcalender and others and see that they use
'XWiki.widgets' or 'XWiki.model', but i have no idea where to lolookinform
myself what XWiki on Javascript-side is to fill my gap of knowledge.
Is there a document where i can look? Or should i use the "only" the
Javascript XWiki API
(http://platform.xwiki.org/xwiki/bin/view/DevGuide/JavaScriptAPI) to read
the object data with velocity or groovy to handle them in javascript. I dont
understood it? What is a preferred solution?
Regards,
Matthias
--
View this message in context: http://xwiki.475771.n2.nabble.com/Javascript-XObjects-tp7594090.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi everybody, my name is Kévin Laîné, i'm a french guy.
I'm working on a collective project about "alternative models of family".
Xwiki seems to be the best community tool management I've discovered.
I'm really interested for opening an xwiki on the "XWiki Community farm". I have some questions before asking you to open a session.
1) Is it possible to use a domain name like "domain.tld" instead of "domain.myxwiki.org" ?
2) Is it possible to install some extensions as bulletin board or others ?
3) Is it possible to embed "Nabble Free Forums" or other Nabble apps ?
4) Is it possible to make private backup of the xwiki ?
Vincent Massol is working on "Alternate URL Scheme" http://dev.xwiki.org/xwiki/bin/view/Design/AlternateURLScheme
5) When it will be ready could I use this option on myxwiki even if I my xwiki is in production ?
Thank you very much for your answers.