Odata request using httpClient

Hi,
I am tring to test out retrieving data into Ignition using httpClient, but I cannot get it to display any data.

This is the basic script i am running, but it just returns 'None':

client = system.net.httpClient()
url = "http://services.odata.org/V3/OData/OData.svc/Products?$format=json"
response = client.get(url)
print response.json

If I send this URL in Postman it returns the data ok.

Any help would be much appreciated.

Thanks

Print the response.statusCode and share your headers used in Postman.


Try creating the client like this:

client = system.net.httpClient(redirect_policy="ALWAYS")

Perfect, thank you Kevin.

The redirect is probably because you're not using https in your URL.

1 Like

Ah yes, it works if i use https.
Thanks