webwrite
Write data to RESTful web service
Syntax
Description
writes content to the web service specified by response = webwrite(url,PostName1,PostValue1,...,PostNameN,PostValueN)url and returns
the response in response. The input arguments
PostName1,PostValue1,...,PostNameN,PostValueN specify the
content to write as one or more pairs of parameter names and values.
webwrite form-encodes the content in the body of an HTTP
POST request to the web service. The web service defines
response.
The web service provides a RESTful interface that returns data formatted as an internet media type, such as JSON, XML, image, or text.
posts response = webwrite(url,data)data to the web service specified by
url and sets the media type based on
data.
The input argument data specifies the content to write as a
form-encoded character array. webwrite puts
data in the body of an HTTP POST request to the web
service. The web service defines response.
adds other HTTP request options, specified by the response = webwrite(___,options)weboptions
object options. You can specify this argument in addition to any
of the input argument combinations in the previous syntaxes.
To write content as an internet media type other than a form-encoded character
array ("application/x-www-form-urlencoded"), specify the
MediaType property of options.
To request data with an HTTP POST request and read the response with a function,
specify the ContentReader property of options
as a handle to the function. If you specify a handle to a function that returns
multiple output arguments, webwrite returns all output
arguments.
Examples
Input Arguments
Output Arguments
More About
Tips
For functionality not supported by the RESTful web services functions, see Call Web Services from MATLAB Using HTTP.
The web services APIs only support HTTP 1.1.
The
webwritefunction writesPostName,PostValueinput arguments as form-encoded character arrays. If you also specify theoptionsinput argument, then itsMediaTypeproperty must be"application/x-www-form-urlencoded".webwritecannot convertdatetimevalues to JSON because JSON does not define a standard date format.webwriteputsPostName,PostValuequery parameters into the body of the message regardless of the value of theRequestMethodproperty ofoptions.For information on how to specify proxy server settings, see Proxy Server Authentication.
Extended Capabilities
Version History
Introduced in R2015aSee Also
Functions
websave|weboptions|webread|datetime|jsonencode|xmlwrite