ResponseForm

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 elemi.

Details

  • 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
    "WXF"record in WXF 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 response form setting 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.
  • ResponseForm has attribute HoldFirst.

Examples

Basic Examples  (3)

Use a custom response format:

Create an API that gives its response directly:

Execute an API and import the result:

Wolfram Research (2014), ResponseForm, Wolfram Language function, https://reference.wolfram.com/language/ref/ResponseForm.html.

Text

Wolfram Research (2014), ResponseForm, Wolfram Language function, https://reference.wolfram.com/language/ref/ResponseForm.html.

CMS

Wolfram Language. 2014. "ResponseForm." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ResponseForm.html.

APA

Wolfram Language. (2014). ResponseForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ResponseForm.html

BibTeX

@misc{reference.wolfram_2023_responseform, author="Wolfram Research", title="{ResponseForm}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ResponseForm.html}", note=[Accessed: 29-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_responseform, organization={Wolfram Research}, title={ResponseForm}, year={2014}, url={https://reference.wolfram.com/language/ref/ResponseForm.html}, note=[Accessed: 29-March-2024 ]}