Changes for page REST API
Last modified by Thomas Mortagne on 2024/03/12
From version 65.1
edited by Thomas Mortagne
on 2017/03/20
on 2017/03/20
Change comment:
There is no comment for this version
To version 67.2
edited by Vincent Massol
on 2017/05/10
on 2017/05/10
Change comment:
Add file format examples written by Jean Simard in the drafts section
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. ThomasMortagne1 +XWiki.VincentMassol - Content
-
... ... @@ -937,6 +937,7 @@ 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 942 942 Since 9.2RC1 jobs started trough the REST API automatically get their runtime context injected with the following REST HTTP request context properties: ... ... @@ -1032,7 +1032,7 @@ 1032 1032 1033 1033 = Using the RESTful API = 1034 1034 1035 -== Highlevel description and tutorialfor a basic usage of the RESTful API==1036 +== Tutorial == 1036 1036 1037 1037 See [[this tutorial>>http://blog.fabio.mancinelli.me/2011/03/07/XWikis_RESTful_API.html]] by Fabio Mancinelli. 1038 1038 ... ... @@ -1104,6 +1104,145 @@ 1104 1104 1105 1105 * 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. 1106 1106 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 + 1107 1107 = Examples = 1108 1108 1109 1109 == 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