====== User Registration API ======
===== Introduction =====
* This document is applicable to the Git version of RADIUSdesk (2021Version)
* We will explain the same API used by a login page that has **User Registration** enabled.
* To enable user registration on a login page, go to the Dynamic Login Pages applet.
* Select a login page and click **Edit**
* At the bottom of the **Settings** sub-tab is a **Registration** tab.
* There you can enable and fine tune it for the specified login page.
===== API =====
==== API URL ====
* We assume the FQDN of the RADIUSdesk server is **hotspot.radiusdesk.com**. Please adapt accordingly.
* http://hotspot.radiusdesk.com/cake3/rd_cake/register-users/new-permanent-user.json
==== Items included in the POST ====
* Let us take a look at the items submitted to the back-end when a user registers and then discuss important items in that list.
{
"mac": "28-D2-44-20-AA-00",
"login_page": "demo1",
"login_page_id": "1",
"name": "Dirk",
"surname": "van der Walt",
"username": "dirkvanderwalt@radiusdesk.com",
"password": "very$ecu3",
"phone": "0721235555"
}
^ Item ^ Typical Value ^ Comment ^
| mac | 28-D2-44-20-AA-00 | Mandatory if the **One user registration per device** is selected |
| login_page | demo1 | Optional - Not required but may be useful to know which login page you work with |
| login_page_id | 1 | The ID is kept in a hidden column under the Dynamic Details Grid |
| name | Dirk | |
| surname | van der Walt | |
| username | dirkvanderwalt@radiusdesk.com | We use the email address as the username |
| password | very$ecu3 | |
| phone | 0721235555 | |
==== Finding the login_page_id ====
* See the following screenshot to get to the login_page_id
{{ :user_guide:login:login_page_id.png?nolink&400 |}}
* The first hidden column contains the value of login_page_id.
==== A Word On The MAC Address ====
* The MAC Address is the MAC address from the WiFi interface of the device that the user will connect with to the Captive Portal.
* When we use the login page to do the user registration we can extract it from the detail provided to us by CoovaChilli typically.
* When we create something like a mobile app and want to allow someone to register **without being connected to the Captive Portal**, we can still supply the MAC address of the device using the app.
* Here is some info on how to get it programmatically: https://stackoverflow.com/questions/10831578/how-to-find-mac-address-of-an-android-device-programmatically/13007454
==== Reply - Success ====
* This is typically what a successful reply will look like
{
"success": true,
"data": {
"active": "active",
"cap_data": "hard",
"language": "4_4",
"user_id": 0,
"profile_id": 3,
"realm_id": 1,
"token": "85eeb70f-2af0-4d45-9fde-1b9a787048ca",
"username": "dirkvanderwalt@radiusdesk.com",
"password": "very$ecur3",
"email": "dirkvanderwalt@radiusdesk.com",
"extra_name": "mac",
"extra_value": "28-D2-44-20-04-8D",
"auto_add": 1,
"name": "Dirk",
"surname": "van der Walt",
"phone": "0721235555"
}
}
==== Reply - Failure ====
* This is a typical message if someone tries to register twice from the same device
{
"success": false,
"errors": {
"username": "MAC Address 28-D2-44-20-04-8D in use by dirkvanderwalt@gmail.com@demo1"
}
}