Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
technical:api-permanent-users [2025/04/12 21:46] – created system | technical:api-permanent-users [2025/04/13 05:23] (current) – system | ||
---|---|---|---|
Line 6: | Line 6: | ||
----- | ----- | ||
- | ====== | + | ====== |
- | * Each **Permanent User**, **Voucher** or **BYOD Device** has to belong to a **Profile** and **Realm** in order to be useful to RADIUS. | + | * A **Permanent User** has to belong to a **Profile** and **Realm** in order to be useful to RADIUS. |
- | * Before | + | * In the previous Wiki Pages we already covered adding |
- | * In this page we will show you how to add a Realm to a Cloud in RADIUSdesk using an API call. | + | * In this page we will show you how to add a Permanent User to a Cloud in RADIUSdesk using an API call. |
* We will use PHP but the principles can be applied using any programming language. | * We will use PHP but the principles can be applied using any programming language. | ||
----------------- | ----------------- | ||
- | ====== Add a Realm using the API ====== | + | ====== Add a Permanent User using the API ====== |
- | * Below is a simple as possible script that can be used as reference when adding a Realm using the API. | + | * Below is a simple as possible script that can be used as reference when adding a Permanent User using the API. |
* We also show the optional fields that can be included in the API call. | * We also show the optional fields that can be included in the API call. | ||
<file php add_permanent_users.php> | <file php add_permanent_users.php> | ||
Line 22: | Line 22: | ||
// Configuration | // Configuration | ||
- | $api_url | + | $api_url |
$token | $token | ||
$cloud_id | $cloud_id | ||
- | $name = ' | + | $username |
+ | $password | ||
+ | $realm | ||
+ | $profile | ||
// Set API payload | // Set API payload | ||
Line 31: | Line 34: | ||
| | ||
//Required Fields | //Required Fields | ||
- | 'name' | + | 'username' |
+ | ' | ||
+ | ' | ||
+ | ' | ||
' | ' | ||
' | ' | ||
- | + | ' | |
+ | |||
/ | / | ||
- | // | + | // |
- | 'phone' | + | 'name' |
- | 'fax' | + | 'surname' |
- | 'cell' | + | 'phone' |
- | ' | + | ' |
- | 'url' | + | 'address' |
- | 'street_no' => '', | + | 'from_date' |
- | 'street' | + | 'to_date' |
- | 'town_suburb' | + | 'realm_id' |
- | 'city' | + | 'profile_id' |
- | 'country' | + | 'static_ip' |
- | 'lon' | + | 'extra_name' |
- | | + | 'extra_value' |
- | 'suffix' | + | 'site' |
- | //Flags (exclude if it should not be set) | + | 'ppsk' |
- | 'suffix_permanent_users' | + | 'auto_add' |
- | 'suffix_vouchers' | + | |
- | 'suffix_devices' | + | |
*/ | */ | ||
]; | ]; | ||
Line 66: | Line 71: | ||
$response = curl_exec($ch); | $response = curl_exec($ch); | ||
curl_close($ch); | curl_close($ch); | ||
- | echo "Added $name: $response\n"; | + | echo "Added $username: $response\n"; |
?> | ?> | ||
</ | </ | ||
- | * Now that we have created | + | * Now that we have created |