EcoStruxure IT forum
Schneider Electric support forum about installation and configuration for DCIM including EcoStruxure IT Expert, IT Advisor, Data Center Expert, and NetBotz
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-11-04 11:11 AM
Hi People, can anyone help me please?
I`m try some tests with DCE API and facing some problems.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-11-04 11:43 AM
Hi @silvio.filho,
First I should warn we have rather limited support for the web services API. In general we support that the API is working, but what you do with it is your problem, unless you're paying for custom services. So just to set expectations - what follows is a best-effort courtesy.
For everything but the ws-events api, authentication is just http-basic. I believe ws-events used a session-based token where you authenticate to receive a token, then further requests just use that token.
For actual requests, the API is all using SOAP, which is XML based - so requests are made by posting appropriately shaped chunks of XML, and the replies come back similarly. The WSDL itself isn't the api endpoint, it's a file that describes the requests that can be made.
I typically use a library for this - either the built-in soap support in php5, or zeep for python3. (Others exist, I know dotnet like their SOAP too, these are just the ones I have any experience with).
What follows is the shortest example I have, to retrieve a single datapoint from a single monitored device. Hopefully it'll give you some ideas to get you in the right direction. I won't vouch for the code quality - I'm tech support, not a programmer. But hopefully you'll get the gist.
#!/usr/bin/env python3
from requests import Session
from requests.auth import HTTPBasicAuth
import zeep
from zeep import xsd
from zeep.transports import Transport
# https://github.com/mvantellingen/python-zeep/blob/master/examples/http_basic_auth.py
session = Session()
session.auth = HTTPBasicAuth('readonly', 'readonly') # user & pass
transport_with_basic_auth = Transport(session=session)
# I need to connect to the DeviceService to translate an IP to a deviceID
# .10 is my DCE
device = zeep.Client(
wsdl='http://10.216.253.10/integration/services/ISXCentralDeviceService_v2_0?wsdl',
transport=transport_with_basic_auth
)
# and the SensorService to retrieve a value from the device.
sensor = zeep.Client(
wsdl='http://10.216.253.10/integration/services/ISXCentralSensorService_v2_0?wsdl',
transport=transport_with_basic_auth
)
# get an ISXCDevice for our chiller unit. .102 is my chiller.
crac = device.service.getDeviceByIPAddress('10.216.253.102')
# Copy the device ID just to save me typing later
crac.id = crac.ISXCNamedElement.ISXCElement.id
# Pull the sensor data; inserting '?' for the locale to stop it panicing.
crac.return_air_temp = sensor.service.getSensorData('?', crac.id+"_RETURN_AIR_TEMP")
print("If the script hasn't died yet, we should have a result of "+crac.return_air_temp.value+" "+crac.return_air_temp.units+" from device "+crac.hostName);
print(crac.return_air_temp)
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.