MATLAB Answers

How to make a RESTful request through a Kerberos proxy?

7 views (last 30 days)
I am trying to make a RESTful request using the code below:
data = webread('https://www.mySite.com/api/FILE.csv')
However, MATLAB is failing and returns:
Error using webread (line 122)
Could not access server. Host not found: http://proxy:Port
My system has a proxy server implemented and all the connections go through it. I do not have a username or password, I only have a .PEM file with the certificates. How can I solve it?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Apr 2020
Direct Kerberos support was introduced in MATLAB R2019b. Hence, if you have access MATALB R2019b or newer, you can pass your certificates file as show below:
site = 'https://www.mySite.com/api/FILE.csv';
options = weboptions('CertificateFilename','C:\PATH\TO\YOUR\FILE.pem');
out = webread(site, options)
Refer to the Server Authentication documentation page below for more information:
However, this will mostly likely not work in older versions of MATLAB. In those cases, the best alternative is to use system command 'curl' as follows (ask your system administrator for the exact details on how to set up the call to "curl"):
[status, result] = system('curl https://www.mySite.com/api/FILE.csv --proxy https://your-proxy-web --proxy-user ":" --proxy-negotiate --proxy-cacert PATH/TO/YOUR/FILE.PEM ')

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2019b

Translated by