Getting Started with the rXg API
April 20, 2024
Overview
The following steps will guide you through getting started with the rXg API.
Environment
This document was written and tested using the following components from the RG Nets ecosystem.
RG Nets | rXg | 13.2 - 15.311
Additional Software
Postman Extension for VS Code
Getting Started
1. Full Documentation can be located in the help section of any rXg. Browse to Help >> RESTful API >> rXg API
2. An API key can be obtained in the admin scaffold. Browse to System >> Admins >> Administrators. There are (2) types of API keys that can be created here. You can create one for a named admin account such as your own. This will mean that every change made through the API will be logged under your admin account.
3. If you need a more general account for your API calls, it would be best to create a service account.
Setting up Postman
These steps assume that you have added the Postman extension to VS code already. These steps will more or less work for the Postman standalone app as well. You may need to tweak them a bit.
1. Create a profile for your lab environment.
1) Click the center button to create a new environment.
2) Click the + icon
3) Name the profile. I typically use the FQDN of the rXg this profile will connect to.
4) Crate a variable called "api_key" and paste the API key copied from the previous step in the initial value column.
5) Crate a variable called "fqdn" and set the initial value as the FQDN of the rXg that you will be using for these API calls.
6) Click Save
2. Create a collection of API Calls and add a new request.
1) Click the left most button to create a new collection.
2) Give the collection a name and click the button to create a new request.
3) Name the request.
4) Configure your API call. In this example we are doing a GET request that will index the accounts in json format. You will notice that we have inculded our environment variables in the API request.
5) Click Save
6) Test your API call by pressing send.
3. Review the results.
Sample API Calls
Now that you have the basics down, here are some API calls that you can test with.
Account Creation
Notes:
The usage_plan key is the record ID of a valid usage plan. From the rXg GUI, you can click show on a usage plan to capture the ID.
The do_apply_usage_plan value of 1 is a true / false value. 1 indicates true in this example.
Account Update
Notes:
The 4 in the API call is account record ID. It may be necessary to run a list command to capture the record ID prior to updating a record.
Account Destroy
Account Creation
Notes:
The usage_plan key is the record ID of a valid usage plan. From the rXg GUI, you can click show on a usage plan to capture the ID.
The do_apply_usage_plan value of 1 is a true / false value. 1 indicates true in this example.
Account Update
Notes:
The 4 in the API call is account record ID. It may be necessary to run a list command to capture the record ID prior to updating a record.
Account Destroy
Sample Error Responses
#Password can either be a shorter more complex password or a really long less complex password. Password must take longer than (1) year to break. #Password will be considered invalid if >90% match to an existing password. Password does not meet the complexity requirements: { "pre_shared_key": [ "is too weak" ] } Password conflicts with another account: { "pre_shared_key": [ "is not valid" ] }
Add MAC to MAC Group
Notes:
The 1 in the JSON data is the MAC Group ID.
Add Device to Account
Notes:
The 10 in the JSON data is the account ID.