sasconnector-php/create_manager.php

98 lines
2.5 KiB
PHP

<?php
require_once 'SASConnector.php';
$api = new SASConnector('172.16.12.108', 'admin', 'admin');
$api->login();
$res = $api->post('manager', [
"username" => "test_manager2",
"enabled" => 1,
"password" => "1234567812345678",
"confirm_password" => "1234567812345678",
"acl_group_id" => 1,
"parent_id" => 1,
"firstname" => "ahmed",
"lastname" => "hamid",
"company" => null,
"email" => null,
"phone" => null,
"city" => null,
"address" => null,
"notes" => null,
"subscriber_prefix" => null,
"subscriber_suffix" => null,
"max_users" => "0",
"group_id" => null,
"site_id" => null,
"debt_limit" => "0",
"discount_rate" => "0",
"mikrotik_addresslist" => null,
"allowed_ppp_services" => null,
"allowed_nases" => [],
"requires_2fa" => 0,
"ignore_captcha" => 0,
"admin_notes" => null,
"force_change_password" => 0,
"limit_delete" => 0,
"limit_delete_count" => "0",
"limit_rename" => 0,
"limit_rename_count" => "0",
"limit_profile_change" => 0,
"limit_profile_change_count" => "0",
"limit_mac_change" => 0,
"limit_mac_change_count" => 0
]);
print_r(json_decode($res));
//this is the expected response
//stdClass Object
//(
// [status] => 200
// [message] => rsp_success
//[data] => stdClass Object
//(
// [username] => test_manager2
//[firstname] => ahmed
//[lastname] => hamid
//[balance] => 0
// [enabled] => 1
// [acl_group_id] => 1
// [parent_id] => 1
// [company] =>
// [email] =>
// [city] =>
// [phone] =>
// [address] =>
// [notes] =>
// [created_by] => 1
// [debt_limit] => 0
// [discount_rate] => 0
// [mikrotik_addresslist] =>
// [max_users] => 0
// [subscriber_prefix] =>
// [subscriber_suffix] =>
// [requires_2fa] => 0
// [ignore_captcha] => 0
// [limit_delete] => 0
// [limit_rename] => 0
// [limit_profile_change] => 0
// [limit_mac_change] => 0
// [limit_delete_count] => 0
// [limit_rename_count] => 0
// [limit_profile_change_count] => 0
// [limit_mac_change_count] => 0
// [force_change_password] => 0
// [site_id] =>
// [group_id] =>
// [created_at] => 2023-07-20 14:53:20
// [id] => 152
// )
//
//)