- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-16-2024 11:16 PM
I'm making a request in an integration to an external API
return self._http_request(
'POST','export/download',
headers={'accept': "application/octet-stream",
'content-type': "application/x-www-form-urlencoded"},
data=payload)
and I get back a data stream - it's looks like it should be a JSON array, but is actually not, it's simply a long list of separate JSON objects, e.g.
{"id":1}
{"id":2}
{"id":3}
so I get the error
File "<string>", line 66, in export_download
File "<string>", line 9423, in _http_request
File "<string>", line 9527, in _handle_success
File "<string>", line 9545, in cast_response
DemistoException: Failed to parse json object from response: b'{"id":"aaaaa","bd.hostname":"host1.bla"}\n{"id":"bbbbb","bd.hostname":"host2.bla"}\n
and so on...
How do I stop Demisto thinking this is a JSON object. - Line 66 is the one shown
06-19-2024 04:20 PM
After much digging, I found you need to set resp_type on the request - not sure why there is no simple documentation on the class, but just needed to add the following to the request
resp_type='text'
Had to eventually find the option here
06-19-2024 04:20 PM
After much digging, I found you need to set resp_type on the request - not sure why there is no simple documentation on the class, but just needed to add the following to the request
resp_type='text'
Had to eventually find the option here
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!