rXg Knowledge Base

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

image.png 123.22 KB

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. 
image.png 106.83 KB

image.png 83.86 KB

image.png 231.27 KB

3. If you need a more general account for your API calls, it would be best to create a service account.

image.png 330.32 KB

image.png 108.85 KB

image.png 110.76 KB

image.png 246.41 KB

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.
image.png 181.92 KB

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.
image.png 302.9 KB

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.
image.png 482.53 KB

Sample API Calls

Now that you have the basics down, here are some API calls that you can test with.

Account Creation
image.png 334.31 KB

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
image.png 272.89 KB

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
image.png 219.46 KB

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


image.png 132.75 KB

Notes:
The 1 in the JSON data is the MAC Group ID.

Add Device to Account
image.png 127.92 KB

Notes:
The 10 in the JSON data is the account ID.



Categories
Configuration Guides
FAQ
3rd Party
Features and Capabilities
Known Issues

Tags
SoftGRE
RUCKUS
SmartZone
IPMI
Dell
Fleet Manager
ESXI
Hardware
Extreme
NAT
Bhyve
Upgrading
DHCP
Performance Improvements
DNS
Licensing
RADIUS
CLI
API
Configuration Templates
SD-WAN
IDV
NVIDIA
IPv6

Cookies help us deliver our services. By using our services, you agree to our use of cookies.