tao-test/app/taoQtiTest/doc/swagger.json

642 lines
27 KiB
JSON

{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "QTI Test REST API",
"description": "#### The QTI Test REST API. An API for the QTI Test specific actions. For generic CRUD actions on tests please see the taoTest Rest API"
},
"schemes": [
"https",
"http"
],
"produces": [
"application/json",
"application/xml",
"text/xml"
],
"basePath": "/",
"tags": [
{
"name": "test",
"description": "Operations about tests"
},
{
"name": "export",
"description": "Operations about test export"
}
],
"paths": {
"/taoQtiTest/RestQtiTests/exportQtiPackage": {
"get": {
"description": "Download a QTI Package for given delivery",
"tags": [
"export"
],
"responses": {
"200": {
"description": "Request was correctly handled, qti package was exported",
"schema": {
"title": "response",
"format": "json",
"type": "object",
"required": [
"success",
"version",
"data"
],
"properties": {
"success": {
"type": "boolean",
"description": "True on success"
},
"version": {
"type": "string",
"description": "Tao version"
},
"data": {
"$ref": "#/definitions/qtiPackageData"
}
}
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/errorModel"
},
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "At least one mandatory parameter was required but found missing in your request",
"version": "3.1.0"
}
}
},
"401": {
"description": "Unauthorized",
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "You don't have permission to access this resource.",
"version": "3.1.0"
}
},
"schema": {
"$ref": "#/definitions/errorModel"
}
},
"500": {
"description": "Internal error, if class-parent-uri is not a valid test class.",
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "Exception error description",
"version": "3.1.0"
}
},
"schema": {
"$ref": "#/definitions/errorModel"
}
}
},
"parameters": [
{
"name": "testUri",
"in": "query",
"description": "Test resource URI",
"type": "string",
"required": true
}
]
}
},
"/taoQtiTest/RestQtiTests/import": {
"post": {
"description": "Import a QTI test package into the TAO platform. Available since Tao 3.1.",
"tags": [
"test"
],
"responses": {
"200": {
"description": "Request was correctly handled, tests were imported",
"schema": {
"title": "response",
"format": "json",
"type": "object",
"required": [
"success",
"version",
"data"
],
"properties": {
"success": {
"type": "boolean",
"description": "True on success"
},
"version": {
"type": "string",
"description": "Tao version"
},
"data": {
"$ref": "#/definitions/data"
}
}
},
"examples": {
"application/json": {
"success": true,
"data": [
{
"testId": "http://tao.local/mytao.rdf#xxxxxxxxxxxxx",
"testItems": [
"http://tao.local/mytao.rdf#xxxxxxxxxxxxx",
"http://tao.local/mytao.rdf#xxxxxxxxxxxxx"
]
}
],
"version": "3.1.0"
}
}
},
"400": {
"description": "Missing or invalid QTI test package",
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "At least one mandatory parameter was required but found missing in your request",
"version": "3.1.0"
}
},
"schema": {
"$ref": "#/definitions/errorModel"
}
},
"401": {
"description": "You are not authorized to access this functionality"
},
"500": {
"description": "Internal error (should not occur)"
}
},
"parameters": [
{
"name": "qtiPackage",
"in": "formData",
"description": "A QTI 2.1 package",
"type": "file",
"required": true
},
{
"name": "class-uri",
"in": "formData",
"description": "Class uri to import test. If not specified root class will be used.",
"type": "string",
"required": false
},
{
"name": "class-label",
"in": "formData",
"description": "Label of class to import test. If not specified root class will be used. If label is not unique first match will be used.",
"type": "string",
"required": false
},
{
"name": "enableMetadataGuardians",
"in": "formData",
"description": "Boolean flag that indicates to use or not metadata guardians during the import. If parameter not specified, metadata guardians will be used by default.",
"type": "boolean",
"required": false
},
{
"name": "enableMetadataValidators",
"in": "formData",
"description": "Boolean flag that indicates to use or not metadata validators during the import. If parameter not specified, metadata guardians will be used by default.",
"type": "boolean",
"required": false
},
{
"name": "itemMustExist",
"in": "formData",
"description": "Boolean flag that indicates whether items must be found by one metadata guardian. In case of the item is not found by a metadata guardian, the import will fail. Default value is false.",
"type": "boolean",
"required": false
},
{
"name": "itemMustBeOverwritten",
"in": "formData",
"description": "Boolean flag that indicates whether items found by guardians should be overwritten. Default value is false.",
"type": "boolean",
"required": false
}
],
"consumes": [
"multipart/form-data"
]
}
},
"/taoQtiTest/RestQtiTests/importDeferred": {
"post": {
"description": "Import a QTI test package into the TAO platform using task queue. Available since Tao 3.1.",
"tags": [
"test"
],
"responses": {
"200": {
"description": "Request was correctly handled, task to import test was created",
"schema": {
"title": "response",
"format": "json",
"type": "object",
"required": [
"success",
"version",
"data"
],
"properties": {
"success": {
"type": "boolean",
"description": "True on success"
},
"version": {
"type": "string",
"description": "Tao version"
},
"data": {
"type": "object",
"properties": {
"reference_id": {
"type": "string",
"description": "Identifier of the task in the task queue"
}
}
}
}
},
"examples": {
"application/json": {
"success": true,
"data": {
"reference_id": "http://tao.local/mytao.rdf#xxxxxxxxxxxxx"
},
"version": "3.1.0"
}
}
},
"400": {
"description": "Missing or invalid QTI test package",
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "At least one mandatory parameter was required but found missing in your request",
"version": "3.1.0"
}
},
"schema": {
"$ref": "#/definitions/errorModel"
}
},
"401": {
"description": "You are not authorized to access this functionality"
},
"500": {
"description": "Internal error (should not occur)"
}
},
"parameters": [
{
"name": "qtiPackage",
"in": "formData",
"description": "A QTI 2.1 package",
"type": "file",
"required": true
},
{
"name": "class-uri",
"in": "formData",
"description": "Class uri to import test. If not specified root class will be used.",
"type": "string",
"required": false
},
{
"name": "class-label",
"in": "formData",
"description": "Label of class to import test. If not specified root class will be used. If label is not unique first match will be used.",
"type": "string",
"required": false
},
{
"name": "enableMetadataGuardians",
"in": "formData",
"description": "Boolean flag that indicates to use or not metadata guardians during the import. If parameter not specified, metadata guardians will be used by default.",
"type": "boolean",
"required": false
},
{
"name": "enableMetadataValidators",
"in": "formData",
"description": "Boolean flag that indicates to use or not metadata validators during the import. If parameter not specified, metadata guardians will be used by default.",
"type": "boolean",
"required": false
},
{
"name": "itemMustExist",
"in": "formData",
"description": "Boolean flag that indicates whether items must be found by one metadata guardian. In case of the item is not found by a metadata guardian, the import will fail. Default value is false.",
"type": "boolean",
"required": false
},
{
"name": "itemMustBeOverwritten",
"in": "formData",
"description": "Boolean flag that indicates whether items found by guardians should be overwritten. Default value is false.",
"type": "boolean",
"required": false
}
],
"consumes": [
"multipart/form-data"
]
}
},
"/taoQtiTest/RestQtiTests/getStatus": {
"get": {
"description": "Check status of import test package task. Available since Tao 3.1.",
"tags": [
"test"
],
"responses": {
"200": {
"description": "Request was correctly handled, task found",
"schema": {
"title": "response",
"format": "json",
"type": "object",
"required": [
"success",
"version",
"data"
],
"properties": {
"success": {
"type": "boolean",
"description": "True on success"
},
"version": {
"type": "string",
"description": "Tao version"
},
"data": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Task execution status"
},
"testId": {
"type": "string",
"description": "Identifier of imported test"
}
}
}
}
},
"examples": {
"application/json": {
"success": true,
"data": {
"status": "Success",
"testId": "http://tao.local/mytao.rdf#xxxxxxxxxxxxx"
},
"version": "3.1.0"
}
}
},
"404": {
"description": "Task with given id was not found"
},
"500": {
"description": "Internal error (should not occur)"
}
},
"parameters": [
{
"name": "id",
"in": "query",
"description": "job reference",
"type": "string",
"required": true
}
],
"consumes": [
"application/x-www-form-urlencoded"
]
}
},
"/taoQtiTest/RestQtiTests/createClass": {
"post": {
"description": "Create a test class",
"tags": [
"test"
],
"parameters": [
{
"name": "class-label",
"in": "formData",
"description": "Test class label to create",
"required": true,
"type": "string"
},
{
"name": "parent-class-uri",
"in": "formData",
"description": "Parent test class uri. If not specified root test class will be used",
"required": false,
"type": "string"
},
{
"name": "class-comment",
"in": "formData",
"description": "The comment of new created class",
"required": false,
"type": "string"
}
],
"consumes": [
"multipart/form-data"
],
"responses": {
"200": {
"description": "Successful response",
"schema": {
"title": "response",
"format": "json",
"type": "object",
"required": [
"success",
"version"
],
"properties": {
"success": {
"type": "boolean",
"description": "false on failure, true on success"
},
"version": {
"type": "string",
"description": "tao version"
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "A message to explain if class is newly created or it already exists"
},
"class-uri": {
"type": "string",
"description": "The uri of newly created test class"
}
}
},
"errorCode": {
"type": "string",
"description": "error code. it appear if success value is false"
},
"errorMsg": {
"type": "string",
"description": "error description. it appear if success value is false"
}
}
},
"examples": {
"application/json": {
"success": true,
"data": {
"class-uri": "http://tao.local/mytao.rdf#xxxxxxxxxxxxx"
},
"version": "3.1.0"
}
}
},
"400": {
"description": "Bad request if you send invalid parameters. class-label uri is mandatory.",
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "At least one mandatory parameter was required but found missing in your request",
"version": "3.1.0"
}
},
"schema": {
"$ref": "#/definitions/errorModel"
}
},
"401": {
"description": "Unauthorized",
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "You don't have permission to access this resource.",
"version": "3.1.0"
}
},
"schema": {
"$ref": "#/definitions/errorModel"
}
},
"500": {
"description": "Internal error, if class-parent-uri is not a valid test class.",
"examples": {
"application/json": {
"success": false,
"errorCode": 0,
"errorMsg": "Exception error description",
"version": "3.1.0"
}
},
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
}
},
"definitions": {
"errorModel": {
"type": "object",
"description": "contain error",
"required": [
"success",
"version",
"errorCode",
"errorMsg"
],
"properties": {
"success": {
"type": "boolean",
"description": "False on failure",
"default": false
},
"version": {
"type": "string",
"description": "Tao version"
},
"errorCode": {
"type": "integer",
"description": "Error code"
},
"errorMsg": {
"type": "string",
"description": "Error description"
}
}
},
"qtiPackageData": {
"description": "Qti Package data",
"type": "array",
"items": {
"$ref": "#/definitions/qtiPackage"
}
},
"data": {
"description": "output user data",
"type": "array",
"items": {
"$ref": "#/definitions/test"
}
},
"qtiPackage": {
"type": "string"
},
"test": {
"type": "object",
"required": [
"testId",
"testItems"
],
"properties": {
"testId": {
"type": "string"
},
"testItems": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"externalDocs": {
"description": "taoQtiTest on Github",
"url": "https://github.com/oat-sa/extension-tao-testqti"
}
}