11-26-2018 01:31 AM
I try to deposit several devices with an end user using Python and the API interface. In Python I use zeep.
But only one device is transmitted at a time.
Here my Python code:
from zeep import Client
from zeep.cache import SqliteCache
from zeep.transports import Transport
from zeep.plugins import HistoryPlugin
from requests import Session
from requests.auth import HTTPBasicAuth
from urllib3 import disable_warnings
from urllib3.exceptions import InsecureRequestWarning
import logging.config
disable_warnings(InsecureRequestWarning)
username = 'cucm_username'
password = 'cucm_password'
host = 'cucm_host'
wsdl = 'file://axlsqltoolkit_cucm//schema//11.5//AXLAPI.wsdl'
location = 'https://{host}:8443/axl/'.format(host=host)
binding = "{http://www.cisco.com/AXLAPIService/}AXLAPIBinding"
session = Session()
session.verify = False
session.auth = HTTPBasicAuth(username, password)
transport = Transport(cache=SqliteCache(), session=session, timeout=20)
history = HistoryPlugin()
client = Client(wsdl=wsdl, transport=transport, plugins=[history])
service = client.create_service(binding, location)Endpoints
resp = service.updateUser(**{'userid': 'tst-user, 'associatedDevices':
[{'device': 'SEP000832C51223'},
{'device': 'SEP000832C63DFF'}]})
This results in the following request:
<?xml version='1.0' encoding='utf-8'?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<ns0:updateUser xmlns:ns0="http://www.cisco.com/AXL/API/11.5">
<userid>tst-user</userid>
<associatedDevices>
<device>SEP000832C51223</device>
</associatedDevices>
</ns0:updateUser>
</soap-env:Body>
</soap-env:Envelope>
The second device is missing. Can someone please help me.
Solved! Go to Solution.
04-25-2019 04:31 AM
Hi Christophe,
the square brackets are on the wrong place.
Thank you for getting me started as well ;-)
resp = service.updateUser(**{'userid': 'tst-user',
'associatedDevices':
{'device':['SEP000832C51223','SEP000832C63DFF']}
}
)
04-25-2019 04:31 AM
Hi Christophe,
the square brackets are on the wrong place.
Thank you for getting me started as well ;-)
resp = service.updateUser(**{'userid': 'tst-user',
'associatedDevices':
{'device':['SEP000832C51223','SEP000832C63DFF']}
}
)
04-25-2019 08:10 AM
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: