Hi,
I was able to successfully extract the CAPC ID with the curl command:
$ curl -k -u user:pass --header 'Content-Type: application/xml' --request POST --data '<LocalIDs><LocalID ID="9528017"/></LocalIDs>' --url https://rhtpcapc001:8182/pc/center/webservice/datasources/dataSourceConsoleName/Data%20Aggregator%40RHTPCADA201/itemids
Result:
<?xml version="1.0" encoding="UTF-8"?><ItemIDResults><ItemIDResult LocalID="9528017" ItemID="828570"/></ItemIDResults>
I built a python script to run the curl command and extract the CAPC ID
#!/usr/bin/python
import requests
import urllib3
import json
urllib3.disable_warnings()
headers = {
'Content-Type': 'application/xml',
}
data = {
'<LocalIDs><LocalID ID': '"9528017"/></LocalIDs>'
}
response = requests.post('https://rhtpcapc001:8182/pc/center/webservice/datasources/dataSourceConsoleName/Data%20Aggregator%40RHTPCADA201/itemids', headers=headers, data=data, verify=False, auth=('user', 'pass'))
print (response.headers['Content-Type'])
print (response.headers)
print (response.text)
print (response.content)
print (response.reason)
however it is giving me an error when I run the script:
text/plain
{'Set-Cookie': 'JSESSIONID=13fkizsp7jiqi1mb4pdtiy3xaf;Path=/pc;Secure', 'Expires': 'Thu, 01 Jan 1970 00:00:00 GMT', 'Content-Type': 'text/plain', 'Date': 'Mon, 08 Apr 2019 15:35:23 GMT', 'Content-Length': '173', 'Server': 'Jetty(9.3.5.v20151012)'}
JAXBException occurred : ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.. ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog..
b'JAXBException occurred : ParseError at [row,col]:[1,1]\nMessage: Content is not allowed in prolog.. ParseError at [row,col]:[1,1]\nMessage: Content is not allowed in prolog.. '
Bad Request
I have no idea what the error means:
ParseError at [row, col]: [1,1]
Message: Content is not allowed in prolog .. ParseError at [row, col]: [1,1]
BR
David