RESTful API, JSON, and Protocol Buffers

Create client programs using the RESTful API, JSON, and Protocol Buffers

The MATLAB® Production Server™ RESTful API enables you to evaluate MATLAB functions on remote servers using JSON representation of MATLAB data types and protocol buffers. You can create client programs in any programming language with an HTTP library. Protocol buffer support is available only in Java® client API.

To communicate with MATLAB Production Server, a client must use

  • RESTful API for the request-response relationship with the server.

  • JSON to represent MATLAB data types or protocol buffers. Protocol buffer support is available only through the Java client API.

Client code that uses the MATLAB Production Server RESTful API and JSON Representation of MATLAB Data Types can be written in web-based languages such as JavaScript® and embedded in HTML pages. These web pages can then be used to send and retrieve requests from a MATLAB Production Server instance.

While web-based applications may be more amenable to client code written in JavaScript, you can use any HTTP supported programming language such Java, Python, C++, .NET, and many others to develop client applications.

If client programs make requests from different domains, programmers using JavaScript must verify whether Cross-Origin Resource Sharing (CORS) is enabled on the MATLAB Production Server. To enable CORS on the server, set the appropriate value for the option cors-allowed-origins in the main_config server configuration file.

The RESTful API supports both the synchronous and asynchronous execution of requests on the server.

Note

  • In order to use the RESTful API and JSON functionality, you must be running MATLAB Production Server and MATLAB Runtime for R2016a or later.

  • In order to use the RESTful API and protocol buffers, you must use the Java client library for R2020a or later.

RESTful API Reference for Server Discovery and Diagnostics

Topics

RESTful API

Learn how the request-response model of the RESTful API for MATLAB Production Server works.

JSON Representation of MATLAB Data Types

Description of how to represent MATLAB data types in JSON.

Web-Based Bond Pricing Tool Using JavaScript

Example of a web-based bond pricing tool using embedded JavaScript.

MATLAB Function Signatures in JSON

Represent MATLAB function signatures in JSON.

Troubleshooting RESTful API Errors

List of HTTP status codes and possible errors.