Write data to RESTful web service
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.
For functionality not supported by the RESTful web services functions, see the HTTP Interface.
The webwrite
function
writes PostName,PostValue
input arguments as form-encoded
character arrays. If you also specify the options
input
argument, then its MediaType
property must be 'application/x-www-form-urlencoded'
.
webwrite
cannot
convert datetime
objects to JSON, because JSON
does not define a standard date format.
webwrite
always puts
PostName,PostValue
query parameters into the body of the
message regardless of the value of the RequestMethod
property of options
.