Skip to content
Ax Kr edited this page Aug 23, 2020 · 22 revisions

JSON API Server

An API is available through the SymjaServer.java which implements a undertow server.

If you start this server you can for example evaluate D(Sin(x),x) with the URL

and get a response in JSON format.

{
  "queryresult" : {
    "success" : "true",
    "error" : "false",
    "numpods" : 3,
    "version" : "0.1",
    "pods" : [ {
      "title" : "Input",
      "scanner" : "Identity",
      "error" : "false",
      "numsubpods" : 1,
      "subpods" : [ {
        "plaintext" : "D(Sin(x),x)",
        "sinput" : "D(Sin(x),x)",
        "latex" : "\\frac{d}{{dx}}\\sin (x)"
      } ]
    }, {
      "title" : "Derivative",
      "scanner" : "Derivative",
      "error" : "false",
      "numsubpods" : 1,
      "subpods" : [ {
        "plaintext" : "Cos(x)",
        "sinput" : "D(Sin(x),x)",
        "latex" : "\\cos (x)"
      } ]
    }, {
      "title" : "Alternate form",
      "scanner" : "Simplification",
      "error" : "false",
      "numsubpods" : 1,
      "subpods" : [ {
        "plaintext" : "1/(2*E^(I*x))+E^(I*x)/2",
        "sinput" : "TrigToExp(Cos(x))",
        "latex" : "\\frac{1}{2\\,{e}^{i \\,x}}+\\frac{{e}^{i \\,x}}{2}"
      } ]
    } ]
  }
}

The following request parameters are available. The input parameter i must be available exactly once. The format parameter f can be set multiple times.

  • i: the expression which should be evaluated in URL encoded form
  • f: plaintext - returns the result in plaintext or markdown format
  • f: latex - returns the result in latex format
  • f: mathml - returns the result in mathml format
  • s: true (any value) - strict Symja expression parsing, if omitted or not set a "fuzzy parser" was used to interpret the input expression
Clone this wiki locally