Skip to content
Stefano Germano edited this page Jul 22, 2020 · 6 revisions

Description of LoIDE API

Websocket

Execute the program in "program" with the option in "name" and the specific solver in "language" and "engine"

Example value

{
  "language": "asp",
  "engine": "dlv",
  "option": [
    {
      "name": "-silent"
    }
  ],
  "program": [
    "test(1)."
  ]
}

JSON Schema

{
  "definitions": "API's schema",
  "type": "object",
  "properties": {
    "engine": {
      "default": "dlv",
      "description": "The engine to run the program",
      "type": "string"
    },
    "language": {
      "default": "asp",
      "description": "The language to run the program",
      "type": "string"
    },
    "option": {
          "name": {
            "default": "",
            "description": "The options of the solver",
            "type": "string"
          },
      "type": "array"
    },
    "program": {
        "default": "",
        "description": "The program to be executed",
        "type": "string"
    }
  },
 "required": ["engine", "language", "program"]
}

Parameter content type

application/json

Examples

Valid Request

  • Content:
{
  "language": "asp",
  "engine": "dlv",
  "option": [
    {
      "name": "-silent"
    }
  ],
  "program": [
    "test(1)."
  ]
}

Success Response

  • Content:
{
  "model": "{test(1)}\n",
  "error": ""
}     

Invalid Request

Please note the missing dot in the logic program

  • Content:
{
  "language": "asp",
  "engine": "dlv",
  "option": [
    {
      "name": "-silent"
    }
  ],
  "program": [
    "test(1)"
  ]
}

Error Response

  • Content:
{
  "model": "",
  "error": "syntax error"
}