Skip to content

Bad request when creating a new user #244

@DavidAnderson684

Description

@DavidAnderson684

Hi,

I'm trying to create a new user... the below throws an exception Guzzle\Http\Exception\ClientErrorResponseException, 'Client error response [status code] 400 [reason phrase] Bad Request [url] https://identity.api.rackspacecloud.com/v2.0/users'

What have I done wrong?

The values of $user and $apikey are fine - I've used these in the same program to create containers, upload to them, download + delete. Also, I've verified that $_POST['newuser'] and $_POST['newemail'] are valid.

        $client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
            'username' => $user,
            'apiKey' => $apikey
        ));

        # Create the new user
        $json = json_encode(array(
            'username' => $_POST['newuser'],
            'email' => $_POST['newemail'],
            'enabled' => true
        ));

        $headers = array('X-Auth-Token' => $client->getToken());

            $response = $client->post(Rackspace::US_IDENTITY_ENDPOINT.'users', $headers, $json)->send();

Many thanks,
David

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions