Hi Andy,
Below extract from the code, as I can verify it does work for NTLM authentication (in fact according to MS the class should handle any authentication challenges automatically).
You need to replace the variables ending in _XXX suffix with your objects. The returned strContent is a valid JSON string which you then need to parse. There's an example of a working parser class in Matlab.
NET.addAssembly('System'); NET.addAssembly('System.Net'); NET.addAssembly('System.Net.Http'); NET.addAssembly('System.Threading.Tasks'); import System.*; import System.Net.*; import System.Net.Http.*; import System.Net.Http.Headers.*;
clientHandler = HttpClientHandler; clientHandler.Credentials = CredentialCache.DefaultNetworkCredentials; client = HttpClient(clientHandler); client.BaseAddress = Uri(strUrl_XXX); client.Timeout = TimeSpan.FromSeconds(90); client.DefaultRequestHeaders.Accept.Clear(); mediatype = MediaTypeWithQualityHeaderValue('application/json'); client.DefaultRequestHeaders.Accept.Add(mediatype);
jsonParams = this.api_create_json(ParamsStructure_XXX); objParams = StringContent(jsonParams, System.Text.Encoding.UTF8, 'application/json'); response = client.PostAsync(strUrl, objParams).Result;
objContent = response.Content.ReadAsStringAsync(); strContent = char(objContent.Result);