Calling Web API using windows(NTLM) authentication

Hi Team

I am attempting to invoke an API upon a change event in my UDT tag value. The API necessitates the use of Windows (NTLM) authentication. While trying to employ system.net.httpGet, I found it lacks parameters for specifying Windows (NTLM) authentication. Guidance would be appreciated.

my sample code

ident='identXXXX'
data_url = 'https://dnrv/api/v1/cells/%s/active-units?includeLinks=false&utc=false' %(ident)

data = system.net.httpGet(
url = data_url,
contentType = "application/json; charset=utf-8",
bypassCertValidation = True,
username = 'XXX',
password ='XXXX'
)

There's no support for NTLM authentication in either the old system.net functions or the newer system.net.httpClient functions. You won't be able to call this API if that's the only authentication mechanism supported.

Thank you, Kevin, for the reply.

It's unfortunate that the API currently only supports NTLM. Is there an alternative method to call this API from Ignition? I need to call this API every 10 seconds as the production line advances at the same interval.

Maybe an external Python script that you invoke from Ignition?

I'm not really sure. It doesn't look like this is even possible from Java without using additional libraries for the NTLM support. Same for Python in terms of additional libraries being needed.

1 Like

May be doable with Apache HttpClient? I vaguely recall testing out something similar about a year ago that used AD credentials, but can't recall if it was NTLM.

Yeah, looks like that might be a possibility: Apache HttpComponents – NTLM support in HttpClient

1 Like

There's also some information on how to use it with manual credentials on this page, section 4.7:

https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/authentication.html

Not sure what version of Apache currently ships with Ignition but hopefully things haven't changed too much. (Edit. Just checked and 8.1.27 has Apache HttpClient 4.5.13)

1 Like