Experience cases of Consume API from WLC

2023-12-27 20:15:08 Published
  • 0 Followed
  • 0Collected ,4078Browsed

Network Topology

The AC serves as a RESTful server and the PC serves as a client, ensuring that the route between the PC and the AC is reachable.

Problem Description

Customer want to get some data from our WLC without Access the WLC.

Process Analysis

1.      Comware devices provide a RESTful API interface. Users can operate the RESTful API interface through RESTful functions to configure and maintain Comware devices. Therefore, you first need to configure the RESTful method to log in to the device.

1.     Enter system view.

system-view

2.     Enable RESTful access over HTTP.

restful http enable

By default, RESTful access over HTTP is disabled.

3.     Create a local user and enter local user view.

local-user user-name [ class manage ]

4.     Configure a password for the local user.

password [ { hash | simple } password ]

5.     (Optional.) Assign a user role to the local user.

authorization-attribute user-role user-role

The default user role is network-operator for a RESTful access user.

6.     Specify the HTTP service for the local user.

service-type http

By default, no service type is specified for a local user.

2.      Postman is a commonly used interface testing tool. Users can use Postman as a RESTful client to configure and maintain Comware devices. Create a new RESTful request, set the requested operation type to POST and enter the URL address http://192.168.1.5/api/v1/tokens. Click the <Authorization> tab, select Type as Basic Auth, and fill in the username and password of the RESTful user in Username and Password.


3.      Click the <Send> button to send a RESTful request. After returning the data as shown in the figure, it means that the Restful client successfully logged in to the device.


4.      The process of performing a GET operation through the Postman tool is: set the operation type of the RESTful request to GET and enter the URL. This example is to obtain Client information, and the URL address is http://192.168.1.5/api/v1/WLANClient/ClientOption.

Add X-Auth-Token and the corresponding value to Headers. This value is the token-id value returned after the last login to the device.


Solution

Users can use Postman as a RESTful client to configure and maintain Comware devices, and can use APIs to obtain device information without logging into the device.

Please rate this case:   
0 Comments

No Comments

Add Comments: