95 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
require_once 'SASConnector.php';
 | 
						|
 | 
						|
$api = new SASConnector('172.16.12.108', 'admin', 'admin');
 | 
						|
$api->login();
 | 
						|
 | 
						|
 | 
						|
$res = $api->post('user', [
 | 
						|
    "username" => "testusertest23",
 | 
						|
    "enabled" => 1,
 | 
						|
    "password" => "asdfghjkl",
 | 
						|
    "confirm_password" => "asdfghjkl",
 | 
						|
    "profile_id" => 2,
 | 
						|
    "parent_id" => 1,
 | 
						|
    "site_id" => null,
 | 
						|
    "mac_auth" => 0,
 | 
						|
    "allowed_macs" => null,
 | 
						|
    "use_separate_portal_password" => 0,
 | 
						|
    "portal_password" => null,
 | 
						|
    "group_id" => 3,
 | 
						|
    "firstname" => null,
 | 
						|
    "lastname" => null,
 | 
						|
    "company" => null,
 | 
						|
    "email" => null,
 | 
						|
    "phone" => null,
 | 
						|
    "city" => null,
 | 
						|
    "address" => null,
 | 
						|
    "apartment" => null,
 | 
						|
    "street" => null,
 | 
						|
    "contract_id" => null,
 | 
						|
    "national_id" => null,
 | 
						|
    "notes" => null,
 | 
						|
    "auto_renew" => 0,
 | 
						|
    "expiration" => "2023-07-23 09:57:54",
 | 
						|
    "simultaneous_sessions" => 1,
 | 
						|
    "static_ip" => null,
 | 
						|
    "mikrotik_winbox_group" => null,
 | 
						|
    "mikrotik_framed_route" => null,
 | 
						|
    "mikrotik_addresslist" => null,
 | 
						|
    "mikrotik_ipv6_prefix" => null,
 | 
						|
    "user_type" => "0",
 | 
						|
    "restricted" => 0
 | 
						|
]);
 | 
						|
print_r(json_decode($res));
 | 
						|
 | 
						|
 | 
						|
 | 
						|
//this is the expected response
 | 
						|
 | 
						|
//stdClass Object
 | 
						|
//(
 | 
						|
//    [status] => 200
 | 
						|
//    [message] => rsp_save_success
 | 
						|
//    [data] => stdClass Object
 | 
						|
//        (
 | 
						|
//            [username] => testusertest23
 | 
						|
//            [enabled] => 1
 | 
						|
//            [profile_id] => 2
 | 
						|
//            [parent_id] => 1
 | 
						|
//            [site_id] =>
 | 
						|
//            [mac_auth] => 0
 | 
						|
//            [use_separate_portal_password] => 0
 | 
						|
//            [group_id] => 3
 | 
						|
//            [firstname] =>
 | 
						|
//            [lastname] =>
 | 
						|
//            [company] =>
 | 
						|
//            [email] =>
 | 
						|
//            [phone] =>
 | 
						|
//            [city] =>
 | 
						|
//            [address] =>
 | 
						|
//            [apartment] =>
 | 
						|
//            [street] =>
 | 
						|
//            [contract_id] =>
 | 
						|
//            [national_id] =>
 | 
						|
//            [notes] =>
 | 
						|
//            [auto_renew] => 0
 | 
						|
//            [expiration] => 2023-07-23 09:57:54
 | 
						|
//            [simultaneous_sessions] => 1
 | 
						|
//            [static_ip] =>
 | 
						|
//            [mikrotik_winbox_group] =>
 | 
						|
//            [mikrotik_framed_route] =>
 | 
						|
//            [mikrotik_addresslist] =>
 | 
						|
//            [mikrotik_ipv6_prefix] =>
 | 
						|
//            [user_type] => 0
 | 
						|
//            [restricted] => 0
 | 
						|
//            [created_by] => 1
 | 
						|
//            [updated_at] => 2023-07-23 10:45:50
 | 
						|
//            [created_at] => 2023-07-23 10:45:50
 | 
						|
//            [id] => 9786
 | 
						|
//            [parent_username] => admin
 | 
						|
//        )
 | 
						|
//
 | 
						|
//)
 |