Search code examples
xmppejabberd

Ejabberd api endpoint private_set won't save the data


I'm trying to manipulate the private storage on ejabberd server, I send the POST with the json to the endpoint private_set. The answer of the call private_set it's 200 and the body 0, means all ok and then I call the other endpoint private_get to query the private storage, and when I do this last call the storage is not updated.

{
    "user": "example",
    "host": "localhost",
    "element": "<query xmlns='jabber:iq:private'><storage xmlns='storage:bookmarks'><conference autojoin='false' jid='test@conference.localhost' name='test'><nick>example</nick></storage></query>"
}

Solution

  • I don't know with older versions, but at least with ejabberd 19.02, the Query element must not be included in the argument. So, there's a mistake in the documentation of the command example argument. Also, you forgot to close the Conference element.

    Try with this:

    {
        "user": "example",
        "host": "localhost",
        "element": "<storage xmlns='storage:bookmarks'><conference autojoin='false' jid='test@conference.localhost' name='test'><nick>example</nick></conference></storage>"
    }