14 Replies Latest reply on Sep 22, 2016 1:06 PM by sergey.batakov

    Using vWLAN APIs

    vasilek New Member

      Hello, I'm testing API. I read a manual. And i have some problems:

      When i enter query:

      curl -H “Accept:application/xml” -X GET -k -u root@adtran.com:blueblue https://server_ip:3000/internalusers?active_domain_name=default



      curl: (52) Empty reply from server


      If i change parameters, server reply html, but i need xml. What i do wrong?


      vWLAN version:




        • Re: Using vWLAN APIs
          daniel.blackmon Employee

          If you haven't already, take a look at Using APIs with vWLAN. This should give you plenty of examples. That said, you should probably modify your curl command.


          curl -i -H "Accept:application/xml" -H "Content-Type:application/xml" -X GET -k -u ${user}:${pass} https://server_ip:3000/locations?active_domain_name="$domain"


          I use this in scripts, and I just tested again before posting.

          1 of 1 people found this helpful
          • Re: Using vWLAN APIs
            vasilek New Member

            Hello, I have anothe question.


            I want to delete internal user, but i don't know parameters in xml request. Maybe someone had to deal with it.

            • Re: Using vWLAN APIs
              vasilek New Member

              If i used -X DELETE . I have reply HTML page 404.

              • Re: Using vWLAN APIs
                kris New Member

                Can you help in get API for username from clients with the ip address ?


                curl -H "Accept:application/xml" -H "Content-Type:application/xml" -X GET -k -u root@adtran.com:blueblue https://server_ip:3000/active_user_statuses?active_domain_name="default"

                  • Re: Using vWLAN APIs
                    daniel.blackmon Employee

                    I apologize in advance if I misunderstood your question, but you cannot pull specific fields directly from the UI. You would have to pull the whole list of active users and parse that out.


                    Maybe we can still help though. I tend towards Python, and I request JSON from the API. The reason being that JSON format translates directly to Python lists and dictionaries. First off, use these HTML headers.

                    HEADERS = {

                            'Accept': 'application/json',

                            'Content-Type': 'application/json'



                    The following code snippet is a method from a larger class which has some defined cleanup functions, so it won't translate directly into other code, but you can perhaps see that what I do is pull the active_user_statuses resource and return a list of individual statuses.

                    def all_user_status(self):

                            """Returns a Python list of active user statuses."""

                            # Statuses will be returned as a list of dictionaries.

                            # Note that the vWLAN API cannot always process this request as there

                            # is a lot of information that gets returned.

                            active_user_statuses = []

                            for status in self.get('active_user_statuses', self.name):

                                if status == 'error':

                                    msg = 'Error: vWLAN API was unable to process this request'



                                    status = self.convert_values(status['active_user_status'])


                            return active_user_statuses


                    Now, to answer your question, here's an example of how what I do.

                    >>> import vwlan

                    >>> d = vwlan.Domain(server_host, server_admin, admin_password, domain_name)

                    >>> for status in d.all_user_status():

                    ...     if 'name' in status:

                    ...             print status['name']

                    ...     if 'host_name' in status:

                    ...             print status['host_name']

                    ...     print status['ipaddr']







                    tl;dr: You need to parse the output returned from the API call, and look for name, host_name, and ipaddr.

                      • Re: Using vWLAN APIs
                        kris New Member

                        Thanks for the reply


                        Sorry I can understand this.


                        my question is to get the Name of the user and access point connected to with the provided ip address ?


                        Will i need to install Python in the windows to get this with the above script ?

                    • Re: Using vWLAN APIs
                      sergey.batakov New Member

                      Hello all.


                      Anyone can help me create location by using API.

                      I'm try example from documentation, but not work

                      curl -i -H “Accept:application/xml” -H “Content-Type:application/xml” -X POST -k -u xxx:xxx -d "<locations><location><name>WIFI0</name><vlan type="integer">1000</vlan><cidr></cidr></location></locations>"




                      1.        <script> 
                      2.           jQuery(function(){jQuery.gritter.add({image:'/assets/error-c9302e0b7e951136df31bed19b68d929.png',title:'Form Error',text:'Name can\'t be blank'});});  
                      3.        </script> 
                      4.        <script> 
                      5.           jQuery(function(){jQuery.gritter.add({image:'/assets/error-c9302e0b7e951136df31bed19b68d929.png',title:'Form Error',text:'CIDR must be a valid IP address'});});  
                      6.        </script> 
                      7.        <script> 
                      8.           jQuery(function(){jQuery.gritter.add({image:'/assets/error-c9302e0b7e951136df31bed19b68d929.png',title:'Form Error',text:'CIDR netmask should be between 0 and 32.'});});  
                      9.        </script> 
                      10.        <script> 
                      11.           jQuery(function(){jQuery.gritter.add({image:'/assets/error-c9302e0b7e951136df31bed19b68d929.png',title:'Form Error',text:'Vlan is not a number'});});  
                      12.        </script> 
                        • Re: Using vWLAN APIs
                          daniel.blackmon Employee

                          There are two things you can try.


                          1. Make sure you include the active_domain_name parameter.
                          2. Remove the encapsulating locations tag.


                          Since you are posting to the locations page anyways, you don't need those outer tags. Your URL should look something like this.




                          You can also use the active_domain_id if you happen to know the ID, but in most cases you would not have that data point.


                          Your data in XML or JSON will look like this.

                          <location><name>WIFI0</name><vlan type="integer">1000</vlan><cidr></cidr></location>

                          {"location" : {"name": "WIFI0", "vlan": 1000, "cidr": ""}}


                          One thing you might consider is manually creating a Location, then use the GET method to pull that data from the system. You can then make sure you have all the formatting correct. Also note that when you create an item you use a POST (which you have correctly done) and you will not include an ID. So when you GET the data, you will see an ID. You do not need to set that when you create a new item.

                            • Re: Using vWLAN APIs
                              sergey.batakov New Member

                              Can you example how can modified AP by API


                              Return 404

                                • Re: Using vWLAN APIs
                                  daniel.blackmon Employee

                                  To edit an AP you do need to get the ID. There's a number of way to pull that, but for visual purposes, just edit the AP through the UI and note the URL you see. It should be something like this.


                                  So now what you want to do is use PUT to update the AP, but you would strip '/edit' from the URL. Something like this.

                                  curl -X PUT https://<server>:3000/accesspoints/8>active_domain_name="default" -d '{"accesspoint": {<ap stuffs>}}"

                                  Please note that I am leaving out username/password information from cURL for the sake a brevity. Your previous comments indicate you are already familiar enough with that part of things.

                                    • Re: Using vWLAN APIs
                                      sergey.batakov New Member


                                      * ALPN, server did not agree to a protocol

                                      * Server auth using Basic with user 'RAPI@XXX'

                                      > POST /accesspoints/103?active_domain_name=default HTTP/1.1

                                      > Host: XXX.XXX.XXX.XX:3000

                                      > Authorization: Basic UkFQSUBzb3V0aC5ydC5ydTpSQVBJMjAxNg==

                                      > User-Agent: curl/7.47.0

                                      > Accept: */*

                                      > “Accept:application/json”

                                      > “Content-Type:application/json”

                                      > Content-Length: 37

                                      > Content-Type: application/x-www-form-urlencoded


                                      * upload completely sent off: 37 out of 37 bytes

                                      < HTTP/1.1 404 Not Found

                                      HTTP/1.1 404 Not Found

                                      < Server: nginx/1.0.15

                                      Server: nginx/1.0.15

                                      Not working.

                                      Maybe something missing....

                              • Re: Using vWLAN APIs
                                sergey.batakov New Member

                                Thank you. It's work.