Home/Support/Support Forum/How to enable connect x2e Web Interface via ssh command-line
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to enable connect x2e Web Interface via ssh command-line

0 votes
How to enable connect x2e Web Interface via ssh command-line?
asked May 22, 2015 in 3rd Party Python and API development in other Languages by maxhawkdown New to the Community (6 points)

Please log in or register to answer this question.

2 Answers

0 votes
This is not possible from the CLI. You may however be able to activate this from the Device Cloud (if connected), or Python/RCI.
answered May 27, 2015 by userid0 Veteran of the Digi Community (2,158 points)
Could you please give me the example for Python/RCI script.
0 votes
# The following lines require manual changes
username = "YourUsername" # enter your username
password = "YourPassword" # enter your password
# This example establishes a https connection, but doesn't provide the server certificate validation.
# Production code should implement certificate validation.
#
import httplib
import base64

# create HTTP basic authentication string, this consists of
# "username:password" base64 encoded
auth = base64.encodestring("%s:%s"%(username,password))[:-1]

# message to send to server
message = """<sci_request version="1.0">
<send_message>
<targets>
<device id="00000000-00000000-######FF-FF######"/>
</targets>
<rci_request version="1.1">
<set_setting>
<http>
<enable>on</enable>
<port>80</port>
</http>
</set_setting>
</rci_request>
</send_message>
</sci_request>
"""
webservice = httplib.HTTPSConnection("devicecloud.digi.com")

# to what URL to send the request with a given HTTP method
webservice.putrequest("POST", "/ws/sci")

# add the authorization string into the HTTP header
webservice.putheader("Authorization", "Basic %s"%auth)

webservice.putheader("Content-type", "text/xml")
webservice.putheader("Content-length", "%d" % len(message))
webservice.putheader("Accept", "text/xml");
webservice.endheaders()
webservice.send(message)

# get the response
response = webservice.getresponse()
statuscode = response.status
statusmessage = response.reason
response_body = response.read()

# print the output to standard out
print (statuscode, statusmessage)
print response_body
answered Jun 2, 2015 by userid0 Veteran of the Digi Community (2,158 points)
...