$realm_id = $XBAR->get_account_id_by_realm($TEMPLATE['realm']); if (strlen($realm_id)) { printf("{$bldylw}WARN: {$bldred}Existing Account SKIPPING CREATION!{$txtrst}\n"); } else { printf("{$bldblu}TEST: Create Account{$txtrst}\n"); $resp = $XBAR->put_account($TEMPLATE); if ($resp['status'] == 'success') { printf("{$bldgrn}PASS: Account Creation Successful.{$txtrst}\n"); $realm_id = $XBAR->get_account_id_by_realm($TEMPLATE['realm']); } else { printf("{$bldred}FAIL: Account Creation Failure. ( {$bldpur} {$resp['message']} {$bldwht} ) {$txtrst}\n\n"); //Without an account it's difficult to test the REST of the api. bwahaha I'm so punneh \(O.O)/ exit(-1); } } $acct = $XBAR->get_account($realm_id); //Sanity check if ($TEMPLATE['realm'] != $acct['realm']) { printf("{$bldred}FATAL: {$bldwht}Response failed sanity check {$bldwht}( {$bldpur}possibly developers sanity too {$bldwht}){$txtrst}\n"); exit(-1); } $TEMPLATE = array(); $TEMPLATE['name'] = $acct['name']; $TEMPLATE['realm'] = $acct['realm']; $TEMPLATE['owner_id'] = $acct['owner_id']; $TEMPLATE['timezone'] = "America/Vancouver"; printf("{$bldblu}TEST: Account Update{$txtrst}\n"); $resp = $XBAR->post_account($TEMPLATE, $realm_id); if ($resp['status'] == 'success') { printf("{$bldgrn}PASS: Account Update Returned Success{$txtrst}\n\n"); $acct = $XBAR->get_account($realm_id);