ResponseForm
This feature relies on access to Wolfram Cloud.

ResponseForm[expr,"fmt"]
represents a response record to be given in a specified format when requested during the execution of a function specified by APIFunction, FormFunction, etc.

ResponseForm[expr,"fmt",{"elem1","elem2",}]
includes only the response record elements .

DetailsDetails

  • ResponseForm[expr,"fmt",] is equivalent to ExportForm[EvaluationData[expr,],"fmt"].
  • By default, the elements included in the response record are:
  • "Result"the result of processing expr
    "Success"whether the evaluation is considered successful
  • Typical formats include:
  • Nonegive a response containing only the result
    "JSON"record in JSON format
    "XML"record in XML format
    "HTML"record in HTML format suitable for display
    "WL"record in Wolfram Language form as text
  • The format specified by ResponseForm takes precedence over a setting for DefaultResponseForm given in APIFunction, FormFunction, etc.
  • The format specified by ResponseForm cannot be overridden by parameters given in the URL used to call an APIFunction etc.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Use a custom response format:

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

Create an API that gives its response directly:

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

Execute an API and import the result:

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