Last updated April 21, 2013. Created by JoeMcGuire on March 25, 2011.
Edited by Pancho, jackbravo. Log in to edit this page.

Example POST

<?xml version="1.0"?>

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.

Looking for support? Visit the forums, or join #drupal-support in IRC.


Where in this method are you sending the session ID? Isn't that required after receiving it from system.connect?

Since the call is done using HTTP I would assume Drupal stores it in a cookie as usual. This requires the client to accept cookies I guess, but I think most clients do that.

Håvard Pedersen
Web developer at Norwegian Centre for Integrated Care and Telemedicine, working with eLearning for the health sector.

Services 7.x-3.0-rc5 has an issue and will always say that the call is missing the username parameter.

<em class="placeholder">ServicesException</em>: Missing required argument username in <em class="placeholder">services_error()</em> (line <em class="placeholder">342</em> of <em class="placeholder">modules/services/</em>).

Kyle committed a fix to the issue in the repository the 9th of August:

David Riccitelli