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
response
. The input arguments
PostName1,PostValue1,...,PostNameN,PostValueN
specify the
content as name-value pairs. webwrite
form-encodes the
name-value pairs in the body of an HTTP POST request to the web service. The web
service defines response
.
The web service provides a RESTful 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 the
data
.
The input argument data
specifies the content 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 use this syntax with any of the input
arguments of 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 the Use HTTP with MATLAB.
The
webwrite
function writesPostName,PostValue
input arguments as form-encoded character arrays. If you also specify theoptions
input argument, then itsMediaType
property must be'application/x-www-form-urlencoded'
.webwrite
cannot convertdatetime
objects to JSON, because JSON does not define a standard date format.webwrite
always putsPostName,PostValue
query parameters into the body of the message regardless of the value of theRequestMethod
property ofoptions
.To specify proxy server settings, see Proxy Server Authentication.
Version History
Introduced in R2015a