HTTPResponse
This feature relies on access to Wolfram Cloud.

HTTPResponse[body]
represents a successful response to an HTTP request, with the specified body and default metadata.

HTTPResponse[body,metadata]
represents a response to an HTTP request, including the specified body and metadata.

DetailsDetails

  • HTTPResponse is usually stored in a CloudObject or specified as the result in an APIFunction or FormFunction.
  • In HTTPResponse[body,], body can be either a string or a list of integer byte values.
  • The metadata in HTTPResponse is an association including the following possible elements:
  • "StatusCode"200HTTP status code
    "ContentType""text/html"MIME type for content
    "Cookies"{}cookies to set
    "Headers"Automatica list of rules giving HTTP response headers

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Return a plain HTTPResponse:

In[1]:=
Click for copyable input
Out[1]=

Use an XMLTemplate to output a result:

In[2]:=
Click for copyable input
Out[2]=

Return arbitrary body and content type:

In[1]:=
Click for copyable input
Out[1]=

Force the browser to download the content:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2014
(10.0)