Hello, I am just starting to use the API queries with python.
I am having some difficulty getting anything to 'PUT' changes for existing devices. I keep getting a HTTP Error 500: Internal Server Error.
I am unsure where to check for logs on the server side for API access attempts or if there even are any such logs.
I have tried multiple attributes but keep getting the same error, here is a sample below.
I have a test.xml file and in that test.xml I have the following
<mobile_device><location><username>testusername</username></location></mobile_device>
code as follows:
------
from urllib2 import urlopen, URLError, HTTPError, Request
from xml.dom import minidom
import base64
my_xml_doc = minidom.parse("test.xml")
url="https://myserver:8443/JSSResource/mobiledevices/id/9999"
req = Request(url, data=my_xml_doc.toprettyxml())
req.add_header('Content-Type','text/xml')
req.get_method=lambda: 'PUT'
base64string=base64.encodestring('myuseraccount:mypassword')
authheader="Basic %s" % base64string
req.add_header("Authorization", authheader)
xmldata = urlopen(req)
-----------------
Since I have never accessed the API before, I am unsure of what I am doing wrong. Does anyone see what I am doing wrong for the following updates? In this case I am trying to update the username to "testusername" on an existing device id 9999
Any assistance in this issue would be appreaciated.