How to make a RESTful request through a Kerberos proxy?

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

Direct Kerberos support was introduced in MATLAB R2019b. Hence, if you have access to MATLAB R2019b or newer, you can pass your certificates file as shown below:
 
site = 'https://www.mySite.com/api/FILE.csv'; options = weboptions('CertificateFilename','C:\PATH\TO\YOUR\FILE.pem'); out = webread(site, options)
For more information, you can access the Server Authentication documentation by executing the following command in the MATLAB command window for release-specific guidance:
>> web(fullfile(docroot, 'matlab/import_export/server-authentication.html'))
However, this will most likely not work in older versions of MATLAB. In those cases, the best alternative is to use the 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 ')
Please follow the below link to search for the required information regarding the current release:

More Answers (0)

Products

Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!