Welcome Guest, Not a member yet? Register   Sign In
Rackspace E-Mail API Library - Rough Draft
#1

[eluser]Jay Logan[/eluser]
Rackspace is a great e-mail service provider. I've set up some of my bigger clients with them as a solution when Google Apps was just overkill. They have a great API that lets me build in tools within CMS admin area to add / edit / delete users. You can even log in as a user if you have to. The API features a lot of other features that I haven't tackled yet. So here is a rough draft of the library I created to tap into the basic features. More API documentation can be found at here: http://api-wiki.apps.rackspace.com/api-w.../Main_Page

EXAMPLE USAGE:

Code:
$user_info['status'] = $this->input->post('status');
$user_info['host_name'] = $this->input->post('host_name');
$user_info['user_name'] = $this->input->post('user_name');
$user_info['password'] = $this->input->post('password');
$user_info['first_name'] = $this->input->post('first_name');
$user_info['last_name'] = $this->input->post('last_name');
$user_info['street_address'] = $this->input->post('street_address');
$user_info['city'] = $this->input->post('city');
$user_info['state'] = $this->input->post('state');
$user_info['country'] = $this->input->post('country');
$user_info['postal_code'] = $this->input->post('postal_code');
$user_info['telephone'] = $this->input->post('telephone');
$user_info['organization'] = $this->input->post('organization');
$user_info['department'] = $this->input->post('department');

$this->rackspace->add_user($user_info);

Plenty of room for improvement with this API. This is just a quick something I whipped up to test functionality.
#2

[eluser]Phil Sturgeon[/eluser]
Good work here Jay.

You might want to consider adding a config file to store your username and password, and as a tiny simplification of code:

Code:
if ($res == 1) {
        
            return FALSE;
            
        } else {
        
            return TRUE;
            
        }

can just be:

Code:
return $res == 1;
// or
return (bool) $res;

Good stuff though.




Theme © iAndrew 2016 - Forum software by © MyBB