----- ====== Realms ====== * Each **Permanent User**, **Voucher** or **BYOD Device** has to belong to a **Profile** and **Realm** in order to be useful to RADIUS. * Before we can bulk import Permanent Users using a CSV file, we need to ensure that all the realms that the users belong to in the CSV file already exist. * In this page we will show you how to add a Realm to a Cloud in RADIUSdesk using an API call. * We will use PHP but the principles can be applied using any programming language. ----------------- ====== Add a Realm using the API ====== * Below is a simple as possible script that can be used as reference when adding a Realm using the API. * We also show the optional fields that can be included in the API call. $name, 'cloud_id' => $cloud_id, 'token' => $token, /* //Optional Fields 'phone' => '', 'fax' => '', 'cell' => '', 'email' => '', 'url' => '', 'street_no' => '', 'street' => '', 'town_suburb' => '', 'city' => '', 'country' => '', 'lon' => 0, 'lat' => 0, 'suffix' => 'example.com', //Flags (exclude if it should not be set) 'suffix_permanent_users' => 'suffix_permanent_users', 'suffix_vouchers' => 'suffix_vouchers', 'suffix_devices' => 'suffix_devices', */ ]; $json_payload = json_encode($payload); $ch = curl_init($api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $json_payload); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $response = curl_exec($ch); curl_close($ch); echo "Added $name: $response\n"; ?> * Now that we have created Profiles and Realms, we can move on to adding a Permanent User.