Kris Wenzel
Kris Wenzel

Reputation: 23

XMLRPC and Drupal

I'm using XMLRPC to create a user and am getting the following two errors:

Illegal choice C in Roles element.
Illegal choice C in Status element

As show by the Recent Log Entries report.

I'm using C# and the XMLRPC (Cook computing) assembly to make my call. I am able to successfully connect and login to the server. The SessionID and cookies are working. I just think there is something I'm missing in user create.

Here are the parameters I'm sending:

[XmlRpcMethod("user.create")]
Drupal UserCreate(string name, string mail, string pass, string status);

Does anyone know why I would be getting this error? Notes: I'm running Drupal 6.22 with Services 3.0.

Upvotes: 1

Views: 563

Answers (1)

Clive
Clive

Reputation: 36957

If you look at /sites/all/modules/services/resources/user_resource.inc, at the _user_resource_create() function you'll see the user is added by simulating the submission of the user_register form. This form requires a roles array parameter with at least one user role in it which you're not currently passing.

I'm not 100% about the status error but try changing the c# type to an int as that's what it is in the Drupal database.

Upvotes: 1

Related Questions