Sample REST (Representational State Transfer) code can be downloaded from the toolkit. REST is a software design schema for Web application development.
To download sample REST API code:
Sample Ruby Client
A sample ruby client is provided as part of this package. The Ruby client can be used as a sample to pull statistics data from NXAnalytics. The response from NXAnalytics is in JSON format.
Contents
Readme.txt file.Ruby script files:
NXAStatsClient.rb
NXARESTClient.rb
NXAResultsJSONParser.rb
NXALogin.rb NXAException.rb
NXAConstants.rb NXAConnectionParams.rb
Requirements To Run Sample Ruby Client
Ruby 2.0 or above. The sample has been tested with Ruby 2.0. To download Ruby use the following:https://www.ruby-lang.org/en/downloads/or%20http://rubyinstaller.org/
Additional Ruby Gems needed to run the sample client are the following.
- ipaddress
- json
- rest-client
Please install the gems before running the sample client.
How To Run the Program From Command Line
ruby NXAStatsClient <IPAddress Of Controller> <Protocol[http|https]> <Port [8080|443]> <Stats_Type>[wlan | rfdomain | radio | client | captive-portal | client-assoc-disassoc] <lookback_duration_in_seconds [ 1 - 2592000]> <username> <password> <number_of_results_to_return [ 1 - 100]>
Sample:
ruby NXAStatsClient 172.20.33.45 https 443 rfdomain 600 admin admin 30
How To Run the Program From IDE
If you are using Eclipse or APTANA or any other IDE please do the following.
- Choose appropriate network proxy settings
- Configure IDE to choose appropriate Ruby interpreter
- Create a Ruby project
- Copy the Ruby files as part of package to the new Ruby project
- Define the arguments required for the main Ruby program
- Run the main Ruby program