<
From version < 64.1 >
edited by Thomas Mortagne
on 2017/02/20
To version < 68.1 >
edited by Thomas Mortagne
on 2017/08/18
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -937,8 +937,17 @@
937 937  Request parameters:
938 938  
939 939  |=Name|=Required|=Values|=Default|=Description|=Version
940 +|##jobType##|yes|||The type of the job to pass to the Job Executor|9.1RC1
940 940  |##async##|no|##true~|false##|##true##|If false, return the response only when the job is done|9.1RC1
941 941  
943 +Since 9.2RC1 jobs started trough the REST API automatically get their runtime context injected with the following REST HTTP request context properties:
944 +
945 +* current wiki
946 +* current user
947 +* request URL and parameters
948 +
949 +Since 9.7RC1 failing jobs with ##async=false## return an error 500.
950 +
942 942  * **HTTP Method:** PUT
943 943  ** **Accepted Media types:**
944 944  *** application/xml (JobRequest element)
... ... @@ -1024,7 +1024,7 @@
1024 1024  
1025 1025  = Using the RESTful API =
1026 1026  
1027 -== Highlevel description and tutorial for a basic usage of the RESTful API ==
1036 +== Tutorial ==
1028 1028  
1029 1029  See [[this tutorial>>http://blog.fabio.mancinelli.me/2011/03/07/XWikis_RESTful_API.html]] by Fabio Mancinelli.
1030 1030  
... ... @@ -1096,6 +1096,145 @@
1096 1096  
1097 1097  * How do you know what kind of information you can send with the XML? You can discover it by using the class description URI. If you go to ##http:~/~/localhost:8080/xwiki/rest/wikis/xwiki/classes ## you will get a list of all the classes defined in the Wiki. By looking at this you will understand what are the properties defined by each class, their types and attributes. In that way you will know what you're allowed to put in the ##<property><value>## elements of the XML you send.
1098 1098  
1108 +== Formats of files ==
1109 +
1110 +A XSD schema exists for XWiki (look [[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]] for the source).
1111 +
1112 +However, you may not know exactly how to write the XML files to use when using the PUT method. First thing to know, you may try to get examples by using ##GET## HTTP request to the REST service using cURL or similar tools.
1113 +
1114 +But in order to help you, you'll find below the different formats that you can use. Note that the following XML files are exhaustive files but not all the elements are required.
1115 +
1116 +=== Example of a file for a ##wiki## ===
1117 +
1118 +{{code language="xml"}}
1119 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1120 +<wiki xmlns="http://www.xwiki.org">
1121 + <id>xwiki</id>
1122 + <name>xwiki</name>
1123 + <description>Some description of the wiki</description>
1124 + <owner>Admin</owner>
1125 +</wiki>
1126 +{{/code}}
1127 +
1128 +=== Example of a file for a ##space## ===
1129 +
1130 +{{code language="xml"}}
1131 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1132 +<space xmlns="http://www.xwiki.org">
1133 + <id>xwiki:Main</id>
1134 + <wiki>xwiki</wiki>
1135 + <name>Main</name>
1136 + <home>xwiki:Main.WebHome</home>
1137 + <xwikiRelativeUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiRelativeUrl>
1138 + <xwikiAbsoluteUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiAbsoluteUrl>
1139 +</space>
1140 +{{/code}}
1141 +
1142 +=== Example of a file for a ##page## ===
1143 +
1144 +{{code language="xml"}}
1145 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1146 +<page xmlns="http://www.xwiki.org">
1147 + <id>xwiki:Main.WebHome</id>
1148 + <fullName>Main.WebHome</fullName>
1149 + <wiki>xwiki</wiki>
1150 + <space>Main</space>
1151 + <name>WebHome</name>
1152 + <title>Home</title>
1153 + <parent/>
1154 + <parentId/>
1155 + <version>1.1</version>
1156 + <author>XWiki.Admin</author>
1157 + <authorName>Administrator</authorName>
1158 + <xwikiRelativeUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiRelativeUrl>
1159 + <xwikiAbsoluteUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiAbsoluteUrl>
1160 + <translations/>
1161 + <syntax>xwiki/2.0</syntax>
1162 + <language/>
1163 + <majorVersion>1</majorVersion>
1164 + <minorVersion>1</minorVersion>
1165 + <hidden>false</hidden>
1166 + <created>2009-09-09T02:00:00+02:00</created>
1167 + <creator>XWiki.Admin</creator>
1168 + <creatorName>Administrator</creatorName>
1169 + <modified>2015-10-29T11:19:02+01:00</modified>
1170 + <modifier>XWiki.Admin</modifier>
1171 + <modifierName>Administrator</modifierName>
1172 + <comment>Imported from XAR</comment>
1173 + <content>{{include reference="Dashboard.WebHome" context="new"/}}</content>
1174 +</page>
1175 +{{/code}}
1176 +
1177 +=== Example of a file for a ##tag## ===
1178 +
1179 +{{code language="xml"}}
1180 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1181 +<tags xmlns="http://www.xwiki.org">
1182 + <tag name="food"></tag>
1183 +</tags>
1184 +{{/code}}
1185 +
1186 +=== Example of a file for a ##comment## ===
1187 +
1188 +{{code language="xml"}}
1189 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1190 +<comments xmlns="http://www.xwiki.org">
1191 + <comment>
1192 + <id>0</id>
1193 + <pageId>xwiki:Main.WebHome</pageId>
1194 + <author>XWiki.Admin</author>
1195 + <authorName>Administrator</authorName>
1196 + <date>2015-11-13T18:20:51.936+01:00</date>
1197 + <highlight/>
1198 + <text>This is a comment</text>
1199 + <replyTo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
1200 + </comment>
1201 +</comments>
1202 +{{/code}}
1203 +
1204 +=== Example of a file for an ##object## ===
1205 +
1206 +{{code language="xml"}}
1207 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1208 +<object xmlns="http://www.xwiki.org">
1209 + <id>xwiki:Main.WebHome:c170a0a8-cc17-41cd-aa1e-6f6faf1d9f28</id>
1210 + <guid>c170a0a8-cc17-41cd-aa1e-6f6faf1d9f28</guid>
1211 + <pageId>xwiki:Main.WebHome</pageId>
1212 + <pageVersion>1.1</pageVersion>
1213 + <wiki>xwiki</wiki>
1214 + <space>Main</space>
1215 + <pageName>WebHome</pageName>
1216 + <pageAuthor>XWiki.superadmin</pageAuthor>
1217 + <className>XWiki.EditModeClass</className>
1218 + <number>0</number>
1219 + <headline>edit</headline>
1220 + <property name="defaultEditMode" type="String">
1221 + <attribute name="name" value="defaultEditMode"/>
1222 + <attribute name="prettyName" value="Default Edit Mode"/>
1223 + <attribute name="unmodifiable" value="0"/>
1224 + <attribute name="disabled" value="0"/>
1225 + <attribute name="size" value="15"/>
1226 + <attribute name="number" value="1"/>
1227 + <value>edit</value>
1228 + </property>
1229 +</object>
1230 +{{/code}}
1231 +
1232 +=== Example of a file for a ##property## ===
1233 +
1234 +{{code language="xml"}}
1235 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1236 +<property xmlns="http://www.xwiki.org" name="defaultEditMode" type="String">
1237 + <attribute name="name" value="defaultEditMode"/>
1238 + <attribute name="prettyName" value="Default Edit Mode"/>
1239 + <attribute name="unmodifiable" value="0"/>
1240 + <attribute name="disabled" value="0"/>
1241 + <attribute name="size" value="15"/>
1242 + <attribute name="number" value="1"/>
1243 + <value>edit</value>
1244 +</property>
1245 +{{/code}}
1246 +
1099 1099  = Examples =
1100 1100  
1101 1101  == Getting the list of users ==
XWiki.XWikiComments[6]
Comment
... ... @@ -1,4 +1,4 @@
1 -Based on the feature request at http://jira.xwiki.org/browse/XWIKI-9123#comment-74977 It is possible to fetch the XHTML content from URL such as
1 +Based on the feature request at https://jira.xwiki.org/browse/XWIKI-9123#comment-74977 It is possible to fetch the XHTML content from URL such as
2 2  http://platform.xwiki.org/xwiki/bin/get/Features/XWikiRESTfulAPI
3 3  or via
4 4  http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI?xpage=plain&outputSyntax=xhtml

Get Connected