Hi,
I am facing this issue while creating a wiki via REST API, below is my curl script and getting this response
curl -X POST
http://localhost:8080/xwiki/rest/wikis/xwiki?media=json
Response
com.xpn.xwiki.plugin.packaging.PackageException: Error number 0 in 5: Exception in plugin [Package]: Could not find the package definition
And sometimes, I am getting this one:
{
“code”: 500,
“contactEmail”: null,
“description”: “The server encountered an unexpected condition which prevented it from fulfilling the request”,
“homeRef”: “/”,
“reasonPhrase”: “Internal Server Error”,
“uri”: “HTTP/1.1: Status Code Definitions
}
Please let me know if I am missing something. Thanks in advance for your help.
The API you are trying to use is actually a XAR import one and it’s failing because you don’t send any XAR file. The API to create a wiki is the /wikimanager
one in https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HXWikiRESTfulAPIDocumentation.
@tmortagne Thanks for your response! I have tried with XAR import, getting same message
com.xpn.xwiki.plugin.packaging.PackageException: Error number 0 in 5: Exception in plugin [Package]: Could not find the package definition
Kindly elaborate the XAR file, may be i am missing something
i have tried XAR file (created a xml and convert it to xar) sample.xar
On my Extensions page, installed “Wiki manager API” and “Wiki manager application”
I have create 2 wikis from the page “Browse Wikis”, can i create a sub-wiki
http://localhost:8080/xwiki/bin/view/WikiManager/
I did not suggested you to send a XAR file. Again this API is not meant to create wikis, just to import a XAR in some wiki. The REST API to create a wiki is the /wikimanager one you can find on https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HXWikiRESTfulAPIDocumentation .
Yes, i am trying /wikimanager API (by Postman)
curl -X POST
http://localhost:8080/xwiki/rest/wikis/wikimanager?media=json&backup=false
Response
{
“code”: 404,
“contactEmail”: null,
“description”: “The server has not found anything matching the request URI”,
“homeRef”: “/”,
“reasonPhrase”: “Not Found”,
“uri”: “HTTP/1.1: Status Code Definitions”
}
It’s /wikimanager
, not /wikis/wikimanager
.
Sorry! that was typo mistake, trying this URL
http://localhost:8080/xwiki/rest/wikimanager?media=json&history=ADD&backup=true
curl --location --request POST ‘http://localhost:8080/xwiki/rest/wikimanager?media=json’
–header ‘Content-Type: application/xml’
–header ‘Authorization: Basic UmFqYW5LdW1hcjoxMjM0NTY=’
–data-raw ‘<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
newwiki
New wiki
just for testing
Admin
’
Getting same response as above