<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos in DevNet Sandbox</title>
    <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4909111#M8515</link>
    <description>&lt;P&gt;The missing "/" is possible, I don't have access to a real API and my post is based on the doc/examples I found on devnet. If you add the "/" and add print statements for content and/or raw, you still get the HTML response I guess?&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;print(r.content)
print(r.raw)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Aug 2023 14:50:38 GMT</pubDate>
    <dc:creator>Marcel Zehnder</dc:creator>
    <dc:date>2023-08-21T14:50:38Z</dc:date>
    <item>
      <title>CUCM AXL API 12.5 - Unable to retrieve a response using python post</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4904433#M8457</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I am new to CUCM AXL API and I was referring the Cisco Dev guide for creating/automating the IP phone/softphone configuration.&lt;/P&gt;&lt;P&gt;In the initial steps I used GET to interact with AXL API and the response code was [200]. While accessing the AXL code via POST with an XML payload &lt;STRONG&gt;(https)&lt;/STRONG&gt; it shows [401] error and response code as [300] using normal &lt;STRONG&gt;http&lt;/STRONG&gt;. The creds are correct, I am unable to figure out the error. One additional info is the site is not secure as the creds are not configured for this test server.&lt;/P&gt;&lt;P&gt;The post is not getting me the XML response it is getting me the html response of the page. (Refer attached images)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;from requests.auth import HTTPBasicAuth&lt;BR /&gt;import base64&lt;BR /&gt;import urllib3&lt;BR /&gt;urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;BR /&gt;import xml.etree.ElementTree as ET&lt;BR /&gt;import xmltodict&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# SOAP request URL&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#url = "&lt;A href="http://doamin-name/axl" target="_blank" rel="noopener nofollow noreferrer"&gt;http://doamin-Name/axl&lt;/A&gt;"&lt;BR /&gt;url1 = "&lt;A href="https://doamin-name:8443/axl/" target="_blank" rel="noopener nofollow noreferrer"&gt;https://doamin-Name:8443/axl/&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# structured XML&lt;BR /&gt;payload ="""&amp;lt;?xml version ="1.0" encoding="utf-8"?&amp;gt;&lt;BR /&gt;&amp;lt;soapenv:Envelope xmlns:soapenv="&lt;A href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank" rel="noopener nofollow noreferrer"&gt;http://schemas.xmlsoap.org/soap/envelope/&lt;/A&gt;" xmlns:ns="&lt;A href="http://www.cisco.com/AXL/API/12.5" target="_blank" rel="noopener nofollow noreferrer"&gt;http://www.cisco.com/AXL/API/12.5&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;soapenv:Header/&amp;gt;&lt;BR /&gt;&amp;lt;soapenv:Body&amp;gt;&lt;BR /&gt;&amp;lt;ns:getCCMVersion&amp;gt;&lt;BR /&gt;&amp;lt;/ns:getCCMVersion&amp;gt;&lt;BR /&gt;&amp;lt;/soapenv:Body&amp;gt;&lt;BR /&gt;&amp;lt;/soapenv:Envelope&amp;gt;"""&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# headers&lt;BR /&gt;headers1 = {&lt;BR /&gt;'Content-Type': 'text/xml;charset=utf-8',&lt;BR /&gt;'SOAPAction': 'CUCM:DB ver=12.5 getCCMVersion',&lt;BR /&gt;'Authorization': 'Basic passw'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;resp = requests.post(url1, verify=False,auth = ('user','passws'), headers=headers1, data = payload, stream = True,timeout=50)&lt;/P&gt;&lt;P&gt;print(resp.content)&lt;/P&gt;&lt;P&gt;events = ET.iterparse(resp.raw)&lt;/P&gt;&lt;P&gt;#for event, elem in events:&lt;BR /&gt;# print(event, elem)&lt;BR /&gt;&lt;BR /&gt;print(resp.content)&lt;/P&gt;&lt;P&gt;print(resp.history)&lt;BR /&gt;print(resp.headers)&lt;BR /&gt;print(resp.request.headers)&lt;BR /&gt;c= resp.cookies&lt;BR /&gt;print("Cookies : ",c)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 09:05:13 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4904433#M8457</guid>
      <dc:creator>pethuraja</dc:creator>
      <dc:date>2023-08-14T09:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4904902#M8464</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1570757"&gt;@pethuraja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for sharing the details. Which sandbox exactly are you using for this?&lt;/P&gt;
&lt;P&gt;It looks like you're using a Python file. Have you tried running the POST request from Postman?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 18:26:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4904902#M8464</guid>
      <dc:creator>Alexander Stevenson</dc:creator>
      <dc:date>2023-08-14T18:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4906077#M8479</link>
      <description>&lt;P&gt;Postman is not permitted to be used in our system. I am using a python from Visual studio to get the task done instead of using postman. I am not sure what a sandbox is actually. I am actually getting the webpage's html response instead of the xml response as mentioned in dev guide&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 05:58:41 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4906077#M8479</guid>
      <dc:creator>pethuraja</dc:creator>
      <dc:date>2023-08-16T05:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4906304#M8481</link>
      <description>&lt;P&gt;I have managed to install postman in my machine, Post request gave 401 error - attaching the response image. Please have a look into it.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 12:54:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4906304#M8481</guid>
      <dc:creator>pethuraja</dc:creator>
      <dc:date>2023-08-16T12:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4907093#M8490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1570757"&gt;@pethuraja&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the Authorization header, you must provide the base64 format of username/password. That can be generated with something like so:&lt;/P&gt;
&lt;P&gt;credentials = f"{user}:{passws}"&lt;BR /&gt;&lt;SPAN&gt;encoded_credentials = &lt;/SPAN&gt;&lt;SPAN&gt;base64.b64encode(&lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;credentials&lt;/SPAN&gt;&lt;SPAN&gt;.encode()).decode()&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It also seems you should implement variables like so:&lt;/P&gt;
&lt;P&gt;headers1 = {&lt;BR /&gt;'Content-Type': 'text/xml;charset=utf-8',&lt;BR /&gt;'SOAPAction': 'CUCM:DB ver=12.5 getCCMVersion',&lt;BR /&gt;'Authorization': f'Basic {encoded_credentials}'&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;# Use the correct variables for authentication&lt;BR /&gt;resp = requests.post(url1, verify=False, auth=(user, passws), headers=headers1, data=payload, stream=True, timeout=50)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also make sure the variable names are consistent. You have both&amp;nbsp;&lt;EM&gt;passws&lt;/EM&gt; and &lt;EM&gt;passw&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 14:36:00 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4907093#M8490</guid>
      <dc:creator>Alexander Stevenson</dc:creator>
      <dc:date>2023-08-17T14:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4908571#M8510</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/976325"&gt;@Alexander Stevenson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Tried the method of encoding the creds in headers and verified the values of the variables as well prior to raising the question in dev hub. But still it fails!. Please review the attached image as it says the test server is running in evaluation mode and is unregistered, Will this affect the API calls? and I am unable to SSH the server as well with the api creds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 05:36:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4908571#M8510</guid>
      <dc:creator>pethuraja</dc:creator>
      <dc:date>2023-08-21T05:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4908640#M8511</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;If you use requests auth parameter you don't need to set the authentication header (requests will handle the base64 encoding).&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import requests

username = "youruser"
password = "yourpassword"
server = "yourserver"

url = f"https://{server}:8443/axl"

headers = {
    "Content-Type": "text/xml;charset=UTF-8",
    "SOAPAction": "CUCM:DB ver=12.5 getCCMVersion"
}

payload = """
&amp;lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/12.5"&amp;gt;
   &amp;lt;soapenv:Header/&amp;gt;
   &amp;lt;soapenv:Body&amp;gt;
      &amp;lt;ns:getCCMVersion&amp;gt;
         &amp;lt;processNodeName&amp;gt;&amp;lt;/processNodeName&amp;gt;
      &amp;lt;/ns:getCCMVersion&amp;gt;
   &amp;lt;/soapenv:Body&amp;gt;
&amp;lt;/soapenv:Envelope&amp;gt;
"""

r = requests.post(url=url, verify=False, auth=(username,password), headers=headers, data=payload)
print(r.status_code)
print(r.text)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Aug 2023 06:28:44 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4908640#M8511</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-08-21T06:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4908981#M8513</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1570757"&gt;@pethuraja&lt;/a&gt;&amp;nbsp;I have a feeling you're close to solving this. Try Marcel's suggestion above (no encoding needed).&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 12:07:22 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4908981#M8513</guid>
      <dc:creator>Alexander Stevenson</dc:creator>
      <dc:date>2023-08-21T12:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4909014#M8514</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/293649"&gt;@Marcel Zehnder&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I have tried the same, I think in the url you are missing a "/" at the end as it would move into the axl service. The code marcel shared give me the html response for the post method instead of the xml object. Adding the response text's images below.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 12:45:35 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4909014#M8514</guid>
      <dc:creator>pethuraja</dc:creator>
      <dc:date>2023-08-21T12:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: CUCM AXL API 12.5 - Unable to retrieve a response using python pos</title>
      <link>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4909111#M8515</link>
      <description>&lt;P&gt;The missing "/" is possible, I don't have access to a real API and my post is based on the doc/examples I found on devnet. If you add the "/" and add print statements for content and/or raw, you still get the HTML response I guess?&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;print(r.content)
print(r.raw)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 14:50:38 GMT</pubDate>
      <guid>https://community.cisco.com/t5/devnet-sandbox/cucm-axl-api-12-5-unable-to-retrieve-a-response-using-python/m-p/4909111#M8515</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-08-21T14:50:38Z</dc:date>
    </item>
  </channel>
</rss>

