Example XMLRPC POST for node.create

Last updated on
30 April 2025

Example POST (D6)

<?xml version='1.0' ?>
<methodCall>
  <methodName>node.create</methodName>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>type</name>
            <value>
              <string>story</string>
            </value>
          </member>
          <member>
            <name>body</name>
            <value>
              <string>Create body input</string>
            </value>
          </member>
          <member>
            <name>title</name>
            <value>
              <string>Test title</string>
            </value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodCall>

(For code applying to the D7 node model, see this comment)

Expected responses

Response code:

if successful:

200 OK

The body contains the nid of the new node.

if unsuccessful:

Response codes:

401 Unauthorized:
Wrong username or password.
406 Not Acceptable:
Title field required / type field is required

Testing the code on your server

  • On your endpoint make sure you enabled the XMLRPC backend and the 'node' resource including the 'create' action.
  • For unauthenticated testing, give anonymous users the permission to create 'article' nodes.
  • Using one of these tools, POST the code to your resource's URL (http://mydrupalsite/foo/node), with 'content-type' being set to 'text/xml' or 'application/xml'.
  • If you aliased the 'node' resource, both the POST URL and the <methodName> need to be adapted.

Help improve this page

Page status: Not set

You can: