Thank you for the quick reply,
First of all, I have to correct myself, I must have confused something here.
I want to add an object from a class that already exists.
Accordingly I have followed these instructions
[https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HCreatinganXWikiObject](https://my Source)
My structure
I have created an application named Customer with the corresponding class.
Here I want to automatically create entries using a database.
To do this, I first create the page and then add the object with class, so that this page appears in application.
The corresponding information for this I had me to one from the upper article as well as directly about the rest API together searched (test page created and looked what was set here).
It has also brought me a bit further, that I can identify the properties correctly.
My XML with properties now looks like this
<?xml version="1.0" encoding="UTF-8"?>
<object xmlns="http://www.xwiki.org">
<className>Customer.Code.CustomerClass</className>
<property Interface="TextArea">hallo</property>
<property />
</object>
Caused we as with my second XML a 400 error.
But with the following error
May 09, 2022 9:54:28 PM org.restlet.ext.jaxb.JaxbRepresentation getObject
WARNING: Unable to unmarshal the XML representation
javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 7; The processing instruction target matching “[xX][mM][lL]” is not allowed.]
Which matches your answer that my XML is wrong.
Accordingly, a minimal example would have to look like this
Send To http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Customer/8888
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.xwiki.org"
xmlns:xwiki="http://www.xwiki.org" elementFormDefault="qualified">
<complexType name="PageSummary">
<complexContent>
<extension base="xwiki:Customer">
<sequence>
<element name="title" type="string">Testpage</element>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
And after that
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.xwiki.org"
xmlns:xwiki="http://www.xwiki.org" elementFormDefault="qualified">
<complexType name="ObjectSummary">
<complexContent>
<extension base="xwiki:Customer">
<sequence>
<element name="className" type="string">Customer.Code.CustomerClass</element>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
The curious thing I don’t understand.
On the one hand the example works, as well as my first XML
the object is added to the page.
The only problem that appears if I had analyzed it correctly, is that XWIKI wants to send me back an XML with the properties of the set classes object,
only there is here a wrong link back which has the consequence that I get a 500er displayed. The but not at all on the create / add refers but on the response.
What makes the error (NUllPointerExecption) in the log of XWIKI seem plausible, since the freshly erstelel object has got no properties from me and are therefore NULL.
What I also do not understand.
if I do it this way my minimal example is also wrong, because I would have to add more information like id,pageid etc…
But why should I do that ? I already specify via the URL where the target is.
Why do I have to add it again in XML?
Or the other way around.
If I simply give it to the rest-api why is it not enough to have the xml completely filled in but to specify the URl where it should be created.