Developer

 View Only
last person joined: yesterday 

Expand all | Collapse all

Updating AP location in visualRF with XML API using python

This thread has been viewed 13 times
  • 1.  Updating AP location in visualRF with XML API using python

    Posted Aug 24, 2023 01:00 PM

    Hi!

    I'm a learn by example type and can't seem to find anything to help me get the syntax right to update AP information using the "add_access_points" API (below)

    Does anyone have sample code with the correct way to use "requests" to update x, y locations for a given ap_id?

    Thank you!

    --Doug

    Access Point Add/Update

    URL

    https://amp.airwave.com/visualrf/add_access_points

    XML Schema

    visualrf_site_access_points.xsd

    Parameters

    site_id: ID of the Site to add access points

    xml XML: document following the above schema

    When adding a planned AP, omit the id attribute and supply manufacturer and model Planning requires radio phy attribute Only AP name, x and y may be updated Only radio beamwidth, orientation, gain and mount may be updated

    Example:

    <?xml version='1.0' encoding='ISO-8859-1'?>

    <visualrf:site_access_points xmlns:visualrf='http://www.airwave.com' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' version='1'>

        <ap id='12660' x='50' y='80'>

            <radio index='1' beamwidth='180' orientation='90' gain='2.5' mount='ceiling'/>

        </ap>

    </visualrf:site_access_points>



  • 2.  RE: Updating AP location in visualRF with XML API using python

    Posted Sep 22, 2023 02:25 PM

    Hi,

    I've spent some trial and error with variations of session.patch, session.put and xml to update the AP x= and y= locations on a floorplan. The response code says "success", but I am not seeing the AP move on the floorplan.

    This is my test code that uses the site-id of the floorplan and xml and calls the API:
    xml_update_ap_visualrf = """
    <?xml version='1.0' encoding='ISO-8859-1'?>
    <visualrf:site_access_points xmlns:visualrf='http://www.airwave.com' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' version='1'>
    <ap id='98' x='42' y='42'>
    <radio index='1' beamwidth='180' orientation='90' gain='2.5' mount='ceiling'/>
    </ap>
    </visualrf:site_access_points>
    """
    
        def update_xml(self, site_id='c442b340-a567-4716-9648-fe9b2b0c2af4' ):
    
            xml_headers = {'Content-Type': 'application/xml'}
            add_visualrf_url = self.api_path('/visualrf/add_access_points')
            xml_data = xml_update_ap_visualrf
            params = {'site_id': site_id,
                      'xml': xml_data }
            params = Airwave.urlencode(params)
    
            response = self.session.put(add_visualrf_url, headers=xml_headers, params=params, verify=False)
            print(response.text)
            return response
    
    This is what I get back:
    <?xml version="1.0" encoding="UTF-8"?>
    <visualrf:results xmlns:visualrf="http://www.airwave.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><success/></visualrf:results>
    

    Is this the right forum to get help/support for the Airwave/visualRF API ? 

    Thanks in advance!

    --Doug