MATLAB Answers

Rest API/Rest API Web Service and MPS

10 views (last 30 days)
JeanN
JeanN on 6 Sep 2021
Answered: Kojiro Saito on 7 Sep 2021
A client will provide a REST API and I need to connect to it through a locally installed Matlab (not Matlab Production Server), download and crunch some data and then send the results back.
I don't have experience with this yet so please excuse if I am mixing terms
Right now I am trying to understand which is the relevant documentation for me and there are two options I am looking at;
1) The methods listed here - https://nl.mathworks.com/help/matlab/internet-file-access.html?s_tid=CRUX_lftnav , all relate to a RESTful Web Service. I don't know yet if the client has a REST API that can be categorized as a web service (it will provide some internal client data) - would anybody know what the 'standard' use case for a REST API is and if it will likely be considered as a 'web service'? I guess the 'web' service part refers to the HTTP protocol and it does need to be a website?
2) Then there is a bunch of documentation related specifically for the Matlab Production Server, which seems to me to be a more general version of dealing with REST APIs - https://nl.mathworks.com/help/mps/restful-api-and-json.html
However, if I understand it well, the second option is exclusive to MPS (and this is not what we will be using to access the API - we will be using standard Matlab Standalone desktop version)
Appreciate any help and clarifications!

Accepted Answer

Kojiro Saito
Kojiro Saito on 7 Sep 2021
In REST API, there are two parts, client and server.
For REST API client, 1) will be helpful. Especially, webread for HTTP GET request and webwrite for HTTP POST request.
Also, there is matlab.net.http command which will be used for accessing compilcated REST API endpoint.
For REST API server, MATLAB Production Server has functions for deploying MATLAB codes to REST API. From REST API clients such as HTML/JavaScript, you can call MPS's endpoint.
I suppose your client will provide REST API server, so you might need to call it from MATLAB. So, 1) would be your choice.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!