This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

HTTP Interface

Communicate with Web service from MATLAB® using HTTP (Hypertext Transfer Protocol)

The MATLAB RESTful web services functions webread, websave, webwrite and the support function weboptions, allow non-programmers to access many web services using HTTP GET and POST methods. For information about these functions, see Web Access.

However, some interactions with a web service are more complex and require functionality not supported by the RESTful web services functions. The MATLAB HTTP interface provides classes for writing web access applications. The interface includes classes for messages, their headers and fields, and other entities defined in The Internet Engineering Task Force (IETF®) standards. The interface contains functions that implement semantics of HTTP messaging and utilities for processing the data sent and received. It also contains support classes required to process, transmit, and receive messages.

Classes

expand all

matlab.net.http.RequestMessageHTTP request message
matlab.net.http.ResponseMessageHTTP response message
matlab.net.http.MessageHTTP request or response message
matlab.net.http.MessageTypeHTTP message type
matlab.net.http.MessageBodyBody of HTTP message
matlab.net.http.ProtocolVersionHTTP protocol version
matlab.net.http.RequestLineFirst line of HTTP request message
matlab.net.http.RequestMethodHTTP request method
matlab.net.http.StartLineFirst line of HTTP message
matlab.net.http.StatusClassStatus class of HTTP response
matlab.net.http.StatusCodeStatus code in HTTP response
matlab.net.http.StatusLineFirst line of HTTP response message
matlab.net.http.HeaderFieldHeader field of HTTP message
matlab.net.http.field.AcceptFieldHTTP Accept header field
matlab.net.http.field.AuthenticateFieldHTTP WWW-Authenticate or Proxy-Authenticate header field
matlab.net.http.field.AuthenticationInfoFieldHTTP Authentication-Info header field in response message
matlab.net.http.field.AuthorizationFieldHTTP Authorization or Proxy-Authorization header field
matlab.net.http.field.ContentDispositionFieldHTTP Content-Disposition header field
matlab.net.http.field.ContentLengthFieldHTTP Content-Length field
matlab.net.http.field.ContentLocationFieldHTTP Content-Location header field
matlab.net.http.field.ContentTypeFieldHTTP Content-Type header field
matlab.net.http.field.CookieFieldHTTP Cookie header field
matlab.net.http.field.DateFieldHTTP Date header field
matlab.net.http.field.GenericFieldHTTP header field with any name and value
matlab.net.http.field.GenericParameterizedFieldGenericField to support parameterized syntax
matlab.net.http.field.HTTPDateFieldHTTP header field containing date
matlab.net.http.field.IntegerFieldBase class for HTTP header fields containing nonnegative integers
matlab.net.http.field.LocationFieldHTTP Location header field
matlab.net.http.field.MediaRangeFieldBase class for HTTP Content-Type and Accept header fields
matlab.net.http.field.SetCookieFieldHTTP Set-Cookie header field
matlab.net.http.field.URIReferenceFieldBase class for HTTP header fields containing URI components
matlab.net.http.io.ContentConsumerConsumer for HTTP message payloads
matlab.net.http.io.FileConsumerConsumer for files in HTTP messages
matlab.net.http.io.StringConsumerString consumer for HTTP payloads
matlab.net.http.io.JSONConsumerContent consumer that converts JSON input into MATLAB data
matlab.net.http.io.ImageConsumerConsumer for image data in HTTP payloads
matlab.net.http.io.MultipartConsumerHelper for multipart content types in HTTP messages
matlab.net.http.io.BinaryConsumerConsumer for binary data in HTTP messages
matlab.net.http.io.GenericConsumerConsumer for multiple content types in HTTP messages
matlab.net.http.io.ContentProviderContentProvider for HTTP message payloads
matlab.net.http.io.FileProviderContentProvider to send files
matlab.net.http.io.FormProviderContentProvider that sends form data
matlab.net.http.io.MultipartFormProviderContentProvider to send multipart/form-data messages
matlab.net.http.io.StringProviderContentProvider to send MATLAB strings
matlab.net.http.io.JSONProviderContentProvider to send MATLAB data as JSON string
matlab.net.http.io.ImageProviderContentProvider to send MATLAB image data
matlab.net.http.io.MultipartProviderContentProvider to send multipart/mixed HTTP messages
matlab.net.http.io.GenericProviderGeneric ContentProvider for HTTP payloads
matlab.net.http.AuthenticationSchemeHTTP Authentication scheme
matlab.net.http.AuthInfoAuthentication or authorization information in HTTP messages
matlab.net.http.CookieHTTP cookie received from server
matlab.net.http.CookieInfoHTTP cookie information
matlab.net.http.CredentialsCredentials for authenticating HTTP requests
matlab.net.http.DispositionResults in HTTP log record
matlab.net.http.HTTPExceptionException thrown by HTTP services
matlab.net.http.HTTPOptionsOptions controlling HTTP message exchange
matlab.net.http.LogRecordHTTP history log record
matlab.net.http.MediaTypeInternet media type used in HTTP headers
matlab.net.http.ProgressMonitorProgress monitor for HTTP message exchange
matlab.net.URIUniform resource identifier (URI)
matlab.net.ArrayFormatConvert arrays in HTTP queries
matlab.net.QueryParameterParameter in query portion of uniform resource identifier (URI)

Functions

matlab.net.base64decodeBase 64 decoding of string
matlab.net.base64encodeBase 64 encoding of byte string or vector

Topics

What Is the HTTP Interface?

Use the HTTP interface to issue properly structured HTTP requests and process their responses.

Send and Receive HTTP Messages

This example shows how to send a request to a server that involves redirection and might require digest authentication.

HTTP Data Type Conversion

The MATLAB HTTP interface automatically converts data types used in HTTP messages to and from MATLAB types.

Manage Cookies

How to manage cookies in HTTP messages.

Display Progress Monitor for HTTP Message

How to implement a progress monitor.

Display Streamed Data in Figure Window

Stream data from a website using a custom StringConsumer and display the results in a figure window.

Display JPEG Images Streamed from IP Camera

Stream video from a website using a MultipartConsumer.

Send Multipart Form Messages

Tips for using multipart form messages.