I have found is possible to bypass SSL certificate validation in scripting using this syntax of httpPost : system.net.httpPost | Ignition User Manual but I am not able to use it, has anybody any sample of it?
The issue is that I have a REST API with self-signed certificate and I am not able to connect it and getting this error message:Error retrieving token: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
And I am getting a 400 error from the server so I assume I am not using it in the right way because Postman is able to connect (with SSL certification validation disabled)
@dpena1 -- in the past, I needed to include 'headers' as part of the token retrieval process; usually provided by the API provider.
@pturmel --I read somewhere on this forum, maybe in the user manual, that creating an httpClient() is very heavyweight. Is there a best practice when implementing these? In the past I have used these when running longer SFCs but have always wondered if that was the best use of them.
They are heavyweight if you create a new one for every request. Don't do that. Create a client in a project library script, outside any function, and you can use it and re-use.
(This kind of code should always be in the project library, not directly in events or transforms.)
I feel better. I called once per SFC call and reused throughout until the block chain completed. Now, sometimes there were several different SFC running simultaneously, each with their own httpClient but, based on what you're saying that should be okay.