<p>The 'jabber:iq:private' namespace has previously been documented in the Jabber Programmers Guide, but not in a canonical form such as the Internet-Drafts or a XEP. This specification documents the existing usage of jabber:iq:private.</p>
<p>A Jabber client can store any arbitrary XML on the server side by sending an &IQ; stanza of type "set" to the server with a &QUERY; child scoped by the 'jabber:iq:private' namespace. The &QUERY; element MAY contain any arbitrary XML fragment as long as the root element of that fragment is scoped by its own namespace. The data can then be retrieved by sending an &IQ; stanza of type "get" with a &QUERY; child scoped by the 'jabber:iq:private' namespace, which in turn contains a child element scoped by the namespace used for storage of that fragment. Using this method, Jabber entities can store private data on the server and retrieve it whenever necessary. The data stored might be anything, as long as it is valid XML. One typical usage for this namespace is the server-side storage of client-specific preferences; another is &xep0048;.</p>
<p>The root element of this namespace is query. At least one child element with a proper namespace MUST be included; otherwise the server MUST respond with a "Not Acceptable" error (see &xep0086; for information about error conditions). A client MUST NOT query for more than namespace in a single IQ get request. However, an IQ set or result MAY contain multiple elements qualified by the same namespace.</p>
<p>If a user attempts to get or set jabber:iq:private data that belongs to another user, the server MUST return a "Forbidden" or "Service Unavailable" error to the sender (the latter condition is in common use by existing implementations, although the former is preferable).</p>
<examplecaption='User Attempts to Get or Set Data for Another User'><![CDATA[
<p>If a user attempts to perform an IQ get without providing a child element, the server SHOULD return a "Bad Format" error (however, some existing implementations return a "Not Acceptable" error in such circumstances):</p>
<examplecaption='User Attempts to Get Data Without Specifying Child Element/Namespace'><![CDATA[
CLIENT:
<iqtype="set"id="1004">
<queryxmlns="jabber:iq:private"/>
</iq>
SERVER:
<iqtype="error"iq="1004">
<queryxmlns="jabber:iq:private"/>
<errorcode="400"type="modify">
<not-acceptable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
<p>Certain namespaces are reserved in Jabber (namespaces beginning with 'jabber:' or 'http://jabber.org/', as well as 'vcard-temp'). If a user attempts to get or set jabber:iq:private data in a reserved namespace, historically some server implementations have chosen to return an error (commonly "Not Acceptable") to the sender. Such behavior is OPTIONAL, but may be encountered by clients when interacting with some existing server implementations.</p>
<examplecaption='User Attempts to Get or Set Data in a Reserved Namespace'><![CDATA[
CLIENT:
<iqtype="set"id="1005">
<queryxmlns="jabber:iq:private">
<vCardxmlns="vcard-temp">
<FN>Hamlet</FN>
</vCard>
</query>
</iq>
SERVER (optional error):
<iqtype="error"iq="1005">
<queryxmlns="jabber:iq:private">
<vCardxmlns="vcard-temp">
<FN>Hamlet</FN>
</vCard>
</query>
<errorcode="406"type="modify">
<not-acceptable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
</section2>
</section1>
<section1topic='Error Conditions'>
<tablecaption='Error Conditions used by jabber:iq:private'>
<tr><th>Condition</th><th>Description</th></tr>
<tr><td>Bad Format</td><td>The IQ get does not contain a child element.</td></tr>
<tr><td>Forbidden</td><td>The IQ get or set is sent to a JID other than that of the sender.</td></tr>
<tr><td>Not Acceptable</td><td>The IQ get or set is qualified by a reserved namespace.</td></tr>
</table>
</section1>
<section1topic='Security Considerations'>
<p>A server MUST NOT allow any entity other than an authorized resource of the user to create, update, or delete private XML stored on behalf of that user.</p>
<p>No action on the part of the ®ISTRAR; is necessary as a result of this document, since 'jabber:iq:private' is already a registered namespace.</p>