-
Notifications
You must be signed in to change notification settings - Fork 248
Description
As far as I can tell, I've found a bug when interacting with the Identity service. I've only tested this with the createUser()
method.
$client = new Rackspace(Rackspace::UK_IDENTITY_ENDPOINT, array(
'username' => $username
'apiKey' => $apiKey
));
$identity = $client->identityService();
$identity->createUser(array(
'username' => $newUsername,
'email' => $newEmail
));
This will result in a 400 response from the API because of an invalid JSON request body. After delving into the code I found that the JSON being sent is indeed invalid according to the API documentation.
This documentation specifies a username
property within the user object of the generated JSON:
http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/POST_addUser__v2.0_users_User_Calls.html
The problem with the SDK lies within the property key aliases defined in the User resource:
https://github.com/rackspace/php-opencloud/blob/master/lib/OpenCloud/Identity/Resource/User.php#L62
name
should in fact be username
, as specified by the documentation above. Making this change solved the issue for me.
Edit: I am aware of this issue but here the request is being made directly through the client object instead of the service object.