Example XMLRPC POST for user.login
Last updated on
30 April 2025
You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules
Example POST
<?xml version="1.0"?>
<methodCall>
<methodName>user.login</methodName>
<params>
<param>
<value><string>username</string></value>
</param>
<param>
<value><string>password</string></value>
</param>
</params>
</methodCall>
Expected responses
if successful:
- 200 OK
The body contains user data and preferences.
if unsuccessful:
Response codes:
- 401 Unauthorized:
- Wrong username or password.
- 406 Not Acceptable:
- Already logged in as some_username
Testing the code on your server
- On your endpoint make sure you enabled the XMLRPC backend and the 'user' resource including the 'login' action.
- In the above code, replace username and password by an existing pair of credentials.
- Using one of these tools, POST the code to your resource's URL (http://mydrupalsite/foo/user), with 'content-type' being set to 'text/xml' or 'application/xml'.
- If you aliased the 'user' resource, both the POST URL and the
<methodName>need to be adapted.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion