diff --git a/api/controllers/FilesController.js b/api/controllers/FilesController.js index 7cf5e26..75b83f0 100644 --- a/api/controllers/FilesController.js +++ b/api/controllers/FilesController.js @@ -7,75 +7,113 @@ var _storagePath = sails.config.storagePath; -module.exports = { - /** - * @apiDefine PhysicalAsset - * @apiParam (PhysicalAsset) {String} label Display name of the PhysicalAsset. - * @apiParam (PhysicalAsset) {Object} buildm JSON-LD object containing metadata - * about the PhysicalAsset as buildM schema instance. - */ - - /** - * @apiDefine DigitalObject - * @apiParam (DigitalObject) {String} label Display name of the DigitalObject. - * @apiParam (DigitalObject) {String} path Absolute path of file on the server. - * @apiParam (DigitalObject) {Array} physicalAssets IDs of the PhysicalAssets this DigitalObject is related to. - * @apiParam (DigitalObject) {Object} semMD SemanticMD instance storing information about the semantic enrichment process. - * @apiParam (DigitalObject) {Array} derivatives DigitalObject instances which were created in the geometric enrichment process. - */ +/** + * @apiDefine FileParam + * @apiParam (File) {String} path Location of the File. + * @apiParam (File) {String} type Type of the File ('e57' or 'ifc-spf'). + * @apiParam (File) {Number} size Size of the File in byte. + * @apiParam (File) {Boolean} directory True, if a directory, otherwise false. + * @apiParam (File) {Date} atime Last access time of the File. + * @apiParam (File) {Date} mtime Last modification time of the File. + * @apiParam (File) {Date} ctime Creation time of the File. + * @apiParam (File) {Date} createdAt Creation time of the database instance. + * @apiParam (File) {Date} updatedAt Last modification time of the database instance. + * @apiParam (File) {Number} id Database instance's unique ID. + */ - /** - * @apiDefine SemanticMD - * @apiSuccess (SemanticMD) {Array} topics List of Topics containing a set of semantic links that specify an information context. - * @apiSuccess (SemanticMD) {Array} candidates List of semantic links related to a Topic. - * @apiSuccess (SemanticMD) {Array} selections List of semantic links which will be connected to the DigitalObject in the SDAS knowledge graph. - */ +/** + * @apiDefine FileSuccess + * @apiSuccess (File) {String} path Location of the File. + * @apiSuccess (File) {String} type Type of the File ('e57' or 'ifc-spf'). + * @apiSuccess (File) {Number} size Size of the File in byte. + * @apiSuccess (File) {Boolean} directory True, if a directory, otherwise false. + * @apiSuccess (File) {Date} atime Last access time of the File. + * @apiSuccess (File) {Date} mtime Last modification time of the File. + * @apiSuccess (File) {Date} ctime Creation time of the File. + * @apiSuccess (File) {Date} createdAt Creation time of the database instance. + * @apiSuccess (File) {Date} updatedAt Last modification time of the database instance. + * @apiSuccess (File) {Number} id Database instance's unique ID. + */ +module.exports = { /** - * @api {get} /sessions/:id Request Session information - * @apiName GetSession - * @apiGroup Session - * @apiVersion 0.6.0 + * @api {get} /files/:id Request File + * @apiVersion 0.7.0 + * @apiName GetFile + * @apiGroup File + * @apiPermission none + * + * @apiDescription Requests a File stored on the server. * - * @apiParam {Number} id Session's unique ID. + * @apiParam {Number} id File's unique ID. * - * @apiSuccess {String} label Display name of the Session. - * @apiSuccess {Array} physicalAssets List of PhysicalAssets in the Session. - * @apiSuccess {Array} digitalObjects List of DigitalObjects in the Session. - * @apiSuccess {Date} createdAt Creation date of the Session. - * @apiSuccess {Date} modifiedAt date of the Session. - * @apiSuccess {Number} ID of the Session. + * @apiExample {curl} Example usage: + * curl -i http://data.duraark.eu/services/api/sessions/files/1 * - * @apiUse SemanticMD + * @apiUse FileSuccess * * @apiSuccessExample Success-Response: * HTTP/1.1 200 OK * { - * "label": "Haus 30", - * "physicalAssets": [], - * "digitalObjects": [], - * "createdAt": [], - * "modifiedAt": [], - * "id": 1, - * } + * "path": "/duraark-storage/files/Nygade_Scan1001.e57", + * "type": "e57", + * "size": 270408704, + * "directory": false, + * "atime": "2015-08-04T19:01:46.000Z", + * "mtime": "2015-07-30T16:16:08.000Z", + * "ctime": "2015-07-30T16:18:51.000Z", + * "createdAt": "2015-08-05T15:20:24.963Z", + * "updatedAt": "2015-08-05T15:20:25.005Z", + * "id": 1 + * } * - * @apiError SessionNotFound The Session was not found. + * @apiError NotFound The File was not found. * * @apiErrorExample Error-Response: * HTTP/1.1 404 Not Found + * Not Found + * + */ + + /** + * @api {post} /files Create File + * @apiVersion 0.7.0 + * @apiName PostFile + * @apiGroup File + * @apiPermission none + * + * @apiDescription Creates a new File on the server. + * + * @apiUse FileParam + * + * @apiSuccessExample Success-Response: + * HTTP/1.1 200 OK * { - * "error": "SessionNotFound" - * } + * "path": "/duraark-storage/files/Nygade_Scan1001.e57", + * "type": "e57", + * "size": 270408704, + * "directory": false, + * "atime": "2015-08-04T19:01:46.000Z", + * "mtime": "2015-07-30T16:16:08.000Z", + * "ctime": "2015-07-30T16:18:51.000Z", + * "createdAt": "2015-08-05T15:20:24.963Z", + * "updatedAt": "2015-08-05T15:20:25.005Z", + * "id": 1 + * } + * + * @apiUse FileSuccess + * */ + // find: function(req, res, next) { // var files = FileService.getFileList({ // path: _storagePath // }); - // + // // _.forEach(files, function(item, idx) { // item.id = idx; // }); - // + // // res.send(files).status(200); // } }; diff --git a/api/controllers/SessionsController.js b/api/controllers/SessionsController.js index 19f2e2d..3e4a1d1 100644 --- a/api/controllers/SessionsController.js +++ b/api/controllers/SessionsController.js @@ -5,4 +5,125 @@ * @help :: See http://links.sailsjs.org/docs/controllers */ -module.exports = {} + /** + * @apiDefine PhysicalAsset + * @apiParam (PhysicalAsset) {String} label Display name of the PhysicalAsset. + * @apiParam (PhysicalAsset) {Object} buildm JSON-LD object containing metadata + * about the PhysicalAsset as buildM schema instance. + */ + + /** + * @apiDefine DigitalObject + * @apiParam (DigitalObject) {String} label Display name of the DigitalObject. + * @apiParam (DigitalObject) {String} path Absolute path of file on the server. + * @apiParam (DigitalObject) {Array} physicalAssets IDs of the PhysicalAssets this DigitalObject is related to. + * @apiParam (DigitalObject) {Object} semMD SemanticMD instance storing information about the semantic enrichment process. + * @apiParam (DigitalObject) {Array} derivatives DigitalObject instances which were created in the geometric enrichment process. + */ + + /** + * @apiDefine SemanticMD + * @apiSuccess (SemanticMD) {Array} topics List of Topics containing a set of semantic links that specify an information context. + * @apiSuccess (SemanticMD) {Array} candidates List of semantic links related to a Topic. + * @apiSuccess (SemanticMD) {Array} selections List of semantic links which will be connected to the DigitalObject in the SDAS knowledge graph. + */ + +module.exports = { + /** + * @api {get} /sessions/:id Request Session + * @apiVersion 0.7.0 + * @apiName GetSession + * @apiGroup Session + * @apiPermission none + * + * @apiDescription Requests a Session stored on the server. + * + * @apiParam {Number} id Session's unique ID. + * + * @apiExample {curl} Example usage: + * curl -i http://data.duraark.eu/services/api/sessions/sessions/1 + * + * @apiSuccess {String} label Display name of the Session. + * @apiSuccess {Array} physicalAssets List of PhysicalAssets in the Session. + * @apiSuccess {Array} digitalObjects List of DigitalObjects in the Session. + * @apiSuccess {Object} config Configuration options for this Session to set available information topics and geometric enrichment tools. + * @apiSuccess {Array} fixedInputFiles If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions. + * @apiSuccess {Date} createdAt Creation date of the Session. + * @apiSuccess {Date} modifiedAt date of the Session. + * @apiSuccess {Number} ID of the Session. + * + * @apiSuccessExample Success-Response: + * HTTP/1.1 200 OK + * { + * "label": "Haus 30", + * "physicalAssets": [], + * "digitalObjects": [], + * "config": [], + * "fixedInputFiles": [], + * "createdAt": [], + * "modifiedAt": [], + * "id": 1, + * } + * + * @apiError NotFound The Session was not found. + * + * @apiErrorExample Error-Response: + * HTTP/1.1 404 Not Found + * Not Found + * + */ + + /** + * @api {post} /sessions Create Session + * @apiVersion 0.7.0 + * @apiName PostSession + * @apiGroup Session + * @apiPermission none + * + * @apiDescription Creates a new Session on the server. + * + * @apiParam {String} label Display name of the Session. + * @apiParam {Array} physicalAssets List of PhysicalAssets in the Session. + * @apiParam {Array} digitalObjects List of DigitalObjects in the Session. + * @apiParam {Object} config Configuration options for this Session to set available information topics and geometric enrichment tools. + * @apiParam {Array} fixedInputFiles If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions. + * @apiParam {Date} createdAt Creation date of the Session. + * @apiParam {Date} modifiedAt date of the Session. + * @apiParam {Number} ID of the Session. + * + * @apiSuccessExample Success-Response: + * HTTP/1.1 200 OK + * { + * "label": "Haus 30", + * "physicalAssets": [], + * "digitalObjects": [], + * "config": [], + * "fixedInputFiles": [], + * "createdAt": [], + * "modifiedAt": [], + * "id": 1, + * } + * + * @apiSuccess {String} label Display name of the Session. + * @apiSuccess {Array} physicalAssets List of PhysicalAssets in the Session. + * @apiSuccess {Array} digitalObjects List of DigitalObjects in the Session. + * @apiSuccess {Object} config Configuration options for this Session to set available information topics and geometric enrichment tools. + * @apiSuccess {Array} fixedInputFiles If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions. + * @apiSuccess {Date} createdAt Creation date of the Session. + * @apiSuccess {Date} modifiedAt date of the Session. + * @apiSuccess {Number} ID of the Session. + * + */ + + // find: function(req, res, next) { + // var files = FileService.getFileList({ + // path: _storagePath + // }); + // + // _.forEach(files, function(item, idx) { + // item.id = idx; + // }); + // + // res.send(files).status(200); + // } +} diff --git a/assets/api_data.js b/assets/api_data.js index d9e77fb..ba97f8f 100644 --- a/assets/api_data.js +++ b/assets/api_data.js @@ -1,11 +1,340 @@ define({ "api": [ + { + "type": "get", + "url": "/files/:id", + "title": "Request File", + "version": "0.7.0", + "name": "GetFile", + "group": "File", + "permission": [ + { + "name": "none" + } + ], + "description": "
Requests a File stored on the server.
", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Number
", + "optional": false, + "field": "id", + "description": "File's unique ID.
" + } + ] + } + }, + "examples": [ + { + "title": "Example usage:", + "content": "curl -i http://data.duraark.eu/services/api/sessions/files/1", + "type": "curl" + } + ], + "success": { + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n \"path\": \"/duraark-storage/files/Nygade_Scan1001.e57\",\n \"type\": \"e57\",\n \"size\": 270408704,\n \"directory\": false,\n \"atime\": \"2015-08-04T19:01:46.000Z\",\n \"mtime\": \"2015-07-30T16:16:08.000Z\",\n \"ctime\": \"2015-07-30T16:18:51.000Z\",\n \"createdAt\": \"2015-08-05T15:20:24.963Z\",\n \"updatedAt\": \"2015-08-05T15:20:25.005Z\",\n \"id\": 1\n }", + "type": "json" + } + ], + "fields": { + "File": [ + { + "group": "File", + "type": "String
", + "optional": false, + "field": "path", + "description": "Location of the File.
" + }, + { + "group": "File", + "type": "String
", + "optional": false, + "field": "type", + "description": "Type of the File ('e57' or 'ifc-spf').
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "size", + "description": "Size of the File in byte.
" + }, + { + "group": "File", + "type": "Boolean
", + "optional": false, + "field": "directory", + "description": "True, if a directory, otherwise false.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "atime", + "description": "Last access time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "mtime", + "description": "Last modification time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "ctime", + "description": "Creation time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation time of the database instance.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "updatedAt", + "description": "Last modification time of the database instance.
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "id", + "description": "Database instance's unique ID.
" + } + ] + } + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "optional": false, + "field": "NotFound", + "description": "The File was not found.
" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": "HTTP/1.1 404 Not Found\nNot Found", + "type": "json" + } + ] + }, + "filename": "api/controllers/FilesController.js", + "groupTitle": "File", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/files/:id" + } + ] + }, + { + "type": "post", + "url": "/files", + "title": "Create File", + "version": "0.7.0", + "name": "PostFile", + "group": "File", + "permission": [ + { + "name": "none" + } + ], + "description": "Creates a new File on the server.
", + "success": { + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n \"path\": \"/duraark-storage/files/Nygade_Scan1001.e57\",\n \"type\": \"e57\",\n \"size\": 270408704,\n \"directory\": false,\n \"atime\": \"2015-08-04T19:01:46.000Z\",\n \"mtime\": \"2015-07-30T16:16:08.000Z\",\n \"ctime\": \"2015-07-30T16:18:51.000Z\",\n \"createdAt\": \"2015-08-05T15:20:24.963Z\",\n \"updatedAt\": \"2015-08-05T15:20:25.005Z\",\n \"id\": 1\n }", + "type": "json" + } + ], + "fields": { + "File": [ + { + "group": "File", + "type": "String
", + "optional": false, + "field": "path", + "description": "Location of the File.
" + }, + { + "group": "File", + "type": "String
", + "optional": false, + "field": "type", + "description": "Type of the File ('e57' or 'ifc-spf').
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "size", + "description": "Size of the File in byte.
" + }, + { + "group": "File", + "type": "Boolean
", + "optional": false, + "field": "directory", + "description": "True, if a directory, otherwise false.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "atime", + "description": "Last access time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "mtime", + "description": "Last modification time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "ctime", + "description": "Creation time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation time of the database instance.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "updatedAt", + "description": "Last modification time of the database instance.
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "id", + "description": "Database instance's unique ID.
" + } + ] + } + }, + "filename": "api/controllers/FilesController.js", + "groupTitle": "File", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/files" + } + ], + "parameter": { + "fields": { + "File": [ + { + "group": "File", + "type": "String
", + "optional": false, + "field": "path", + "description": "Location of the File.
" + }, + { + "group": "File", + "type": "String
", + "optional": false, + "field": "type", + "description": "Type of the File ('e57' or 'ifc-spf').
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "size", + "description": "Size of the File in byte.
" + }, + { + "group": "File", + "type": "Boolean
", + "optional": false, + "field": "directory", + "description": "True, if a directory, otherwise false.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "atime", + "description": "Last access time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "mtime", + "description": "Last modification time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "ctime", + "description": "Creation time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation time of the database instance.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "updatedAt", + "description": "Last modification time of the database instance.
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "id", + "description": "Database instance's unique ID.
" + } + ] + } + } + }, { "type": "get", "url": "/sessions/:id", - "title": "Request Session information", + "title": "Request Session", + "version": "0.7.0", "name": "GetSession", "group": "Session", - "version": "0.6.0", + "permission": [ + { + "name": "none" + } + ], + "description": "Requests a Session stored on the server.
", "parameter": { "fields": { "Parameter": [ @@ -19,6 +348,13 @@ define({ "api": [ ] } }, + "examples": [ + { + "title": "Example usage:", + "content": "curl -i http://data.duraark.eu/services/api/sessions/sessions/1", + "type": "curl" + } + ], "success": { "fields": { "Success 200": [ @@ -43,6 +379,20 @@ define({ "api": [ "field": "digitalObjects", "description": "List of DigitalObjects in the Session.
" }, + { + "group": "Success 200", + "type": "Object
", + "optional": false, + "field": "config", + "description": "Configuration options for this Session to set available information topics and geometric enrichment tools.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "fixedInputFiles", + "description": "If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
" + }, { "group": "Success 200", "type": "Date
", @@ -64,35 +414,12 @@ define({ "api": [ "field": "ID", "description": "of the Session.
" } - ], - "": [ - { - "group": "SemanticMD", - "type": "Array
", - "optional": false, - "field": "topics", - "description": "List of Topics containing a set of semantic links that specify an information context.
" - }, - { - "group": "SemanticMD", - "type": "Array
", - "optional": false, - "field": "candidates", - "description": "List of semantic links related to a Topic.
" - }, - { - "group": "SemanticMD", - "type": "Array
", - "optional": false, - "field": "selections", - "description": "List of semantic links which will be connected to the DigitalObject in the SDAS knowledge graph.
" - } ] }, "examples": [ { "title": "Success-Response:", - "content": "HTTP/1.1 200 OK\n{\n \"label\": \"Haus 30\",\n \"physicalAssets\": [],\n \"digitalObjects\": [],\n \"createdAt\": [],\n \"modifiedAt\": [],\n \"id\": 1,\n}", + "content": "HTTP/1.1 200 OK\n{\n \"label\": \"Haus 30\",\n \"physicalAssets\": [],\n \"digitalObjects\": [],\n \"config\": [],\n \"fixedInputFiles\": [],\n \"createdAt\": [],\n \"modifiedAt\": [],\n \"id\": 1,\n}", "type": "json" } ] @@ -103,7 +430,7 @@ define({ "api": [ { "group": "Error 4xx", "optional": false, - "field": "SessionNotFound", + "field": "NotFound", "description": "The Session was not found.
" } ] @@ -111,12 +438,169 @@ define({ "api": [ "examples": [ { "title": "Error-Response:", - "content": "HTTP/1.1 404 Not Found\n{\n \"error\": \"SessionNotFound\"\n}", + "content": "HTTP/1.1 404 Not Found\nNot Found", "type": "json" } ] }, - "filename": "api/controllers/FilesController.js", - "groupTitle": "Session" + "filename": "api/controllers/SessionsController.js", + "groupTitle": "Session", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/sessions/:id" + } + ] + }, + { + "type": "post", + "url": "/sessions", + "title": "Create Session", + "version": "0.7.0", + "name": "PostSession", + "group": "Session", + "permission": [ + { + "name": "none" + } + ], + "description": "Creates a new Session on the server.
", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String
", + "optional": false, + "field": "label", + "description": "Display name of the Session.
" + }, + { + "group": "Parameter", + "type": "Array
", + "optional": false, + "field": "physicalAssets", + "description": "List of PhysicalAssets in the Session.
" + }, + { + "group": "Parameter", + "type": "Array
", + "optional": false, + "field": "digitalObjects", + "description": "List of DigitalObjects in the Session.
" + }, + { + "group": "Parameter", + "type": "Object
", + "optional": false, + "field": "config", + "description": "Configuration options for this Session to set available information topics and geometric enrichment tools.
" + }, + { + "group": "Parameter", + "type": "Array
", + "optional": false, + "field": "fixedInputFiles", + "description": "If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
" + }, + { + "group": "Parameter", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation date of the Session.
" + }, + { + "group": "Parameter", + "type": "Date
", + "optional": false, + "field": "modifiedAt", + "description": "date of the Session.
" + }, + { + "group": "Parameter", + "type": "Number
", + "optional": false, + "field": "ID", + "description": "of the Session.
" + } + ] + } + }, + "success": { + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n \"label\": \"Haus 30\",\n \"physicalAssets\": [],\n \"digitalObjects\": [],\n \"config\": [],\n \"fixedInputFiles\": [],\n \"createdAt\": [],\n \"modifiedAt\": [],\n \"id\": 1,\n}", + "type": "json" + } + ], + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String
", + "optional": false, + "field": "label", + "description": "Display name of the Session.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "physicalAssets", + "description": "List of PhysicalAssets in the Session.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "digitalObjects", + "description": "List of DigitalObjects in the Session.
" + }, + { + "group": "Success 200", + "type": "Object
", + "optional": false, + "field": "config", + "description": "Configuration options for this Session to set available information topics and geometric enrichment tools.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "fixedInputFiles", + "description": "If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
" + }, + { + "group": "Success 200", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation date of the Session.
" + }, + { + "group": "Success 200", + "type": "Date
", + "optional": false, + "field": "modifiedAt", + "description": "date of the Session.
" + }, + { + "group": "Success 200", + "type": "Number
", + "optional": false, + "field": "ID", + "description": "of the Session.
" + } + ] + } + }, + "filename": "api/controllers/SessionsController.js", + "groupTitle": "Session", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/sessions" + } + ] } ] }); \ No newline at end of file diff --git a/assets/api_data.json b/assets/api_data.json index 83dc867..759df51 100644 --- a/assets/api_data.json +++ b/assets/api_data.json @@ -1,11 +1,340 @@ [ + { + "type": "get", + "url": "/files/:id", + "title": "Request File", + "version": "0.7.0", + "name": "GetFile", + "group": "File", + "permission": [ + { + "name": "none" + } + ], + "description": "Requests a File stored on the server.
", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "Number
", + "optional": false, + "field": "id", + "description": "File's unique ID.
" + } + ] + } + }, + "examples": [ + { + "title": "Example usage:", + "content": "curl -i http://data.duraark.eu/services/api/sessions/files/1", + "type": "curl" + } + ], + "success": { + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n \"path\": \"/duraark-storage/files/Nygade_Scan1001.e57\",\n \"type\": \"e57\",\n \"size\": 270408704,\n \"directory\": false,\n \"atime\": \"2015-08-04T19:01:46.000Z\",\n \"mtime\": \"2015-07-30T16:16:08.000Z\",\n \"ctime\": \"2015-07-30T16:18:51.000Z\",\n \"createdAt\": \"2015-08-05T15:20:24.963Z\",\n \"updatedAt\": \"2015-08-05T15:20:25.005Z\",\n \"id\": 1\n }", + "type": "json" + } + ], + "fields": { + "File": [ + { + "group": "File", + "type": "String
", + "optional": false, + "field": "path", + "description": "Location of the File.
" + }, + { + "group": "File", + "type": "String
", + "optional": false, + "field": "type", + "description": "Type of the File ('e57' or 'ifc-spf').
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "size", + "description": "Size of the File in byte.
" + }, + { + "group": "File", + "type": "Boolean
", + "optional": false, + "field": "directory", + "description": "True, if a directory, otherwise false.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "atime", + "description": "Last access time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "mtime", + "description": "Last modification time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "ctime", + "description": "Creation time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation time of the database instance.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "updatedAt", + "description": "Last modification time of the database instance.
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "id", + "description": "Database instance's unique ID.
" + } + ] + } + }, + "error": { + "fields": { + "Error 4xx": [ + { + "group": "Error 4xx", + "optional": false, + "field": "NotFound", + "description": "The File was not found.
" + } + ] + }, + "examples": [ + { + "title": "Error-Response:", + "content": "HTTP/1.1 404 Not Found\nNot Found", + "type": "json" + } + ] + }, + "filename": "api/controllers/FilesController.js", + "groupTitle": "File", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/files/:id" + } + ] + }, + { + "type": "post", + "url": "/files", + "title": "Create File", + "version": "0.7.0", + "name": "PostFile", + "group": "File", + "permission": [ + { + "name": "none" + } + ], + "description": "Creates a new File on the server.
", + "success": { + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n \"path\": \"/duraark-storage/files/Nygade_Scan1001.e57\",\n \"type\": \"e57\",\n \"size\": 270408704,\n \"directory\": false,\n \"atime\": \"2015-08-04T19:01:46.000Z\",\n \"mtime\": \"2015-07-30T16:16:08.000Z\",\n \"ctime\": \"2015-07-30T16:18:51.000Z\",\n \"createdAt\": \"2015-08-05T15:20:24.963Z\",\n \"updatedAt\": \"2015-08-05T15:20:25.005Z\",\n \"id\": 1\n }", + "type": "json" + } + ], + "fields": { + "File": [ + { + "group": "File", + "type": "String
", + "optional": false, + "field": "path", + "description": "Location of the File.
" + }, + { + "group": "File", + "type": "String
", + "optional": false, + "field": "type", + "description": "Type of the File ('e57' or 'ifc-spf').
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "size", + "description": "Size of the File in byte.
" + }, + { + "group": "File", + "type": "Boolean
", + "optional": false, + "field": "directory", + "description": "True, if a directory, otherwise false.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "atime", + "description": "Last access time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "mtime", + "description": "Last modification time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "ctime", + "description": "Creation time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation time of the database instance.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "updatedAt", + "description": "Last modification time of the database instance.
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "id", + "description": "Database instance's unique ID.
" + } + ] + } + }, + "filename": "api/controllers/FilesController.js", + "groupTitle": "File", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/files" + } + ], + "parameter": { + "fields": { + "File": [ + { + "group": "File", + "type": "String
", + "optional": false, + "field": "path", + "description": "Location of the File.
" + }, + { + "group": "File", + "type": "String
", + "optional": false, + "field": "type", + "description": "Type of the File ('e57' or 'ifc-spf').
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "size", + "description": "Size of the File in byte.
" + }, + { + "group": "File", + "type": "Boolean
", + "optional": false, + "field": "directory", + "description": "True, if a directory, otherwise false.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "atime", + "description": "Last access time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "mtime", + "description": "Last modification time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "ctime", + "description": "Creation time of the File.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation time of the database instance.
" + }, + { + "group": "File", + "type": "Date
", + "optional": false, + "field": "updatedAt", + "description": "Last modification time of the database instance.
" + }, + { + "group": "File", + "type": "Number
", + "optional": false, + "field": "id", + "description": "Database instance's unique ID.
" + } + ] + } + } + }, { "type": "get", "url": "/sessions/:id", - "title": "Request Session information", + "title": "Request Session", + "version": "0.7.0", "name": "GetSession", "group": "Session", - "version": "0.6.0", + "permission": [ + { + "name": "none" + } + ], + "description": "Requests a Session stored on the server.
", "parameter": { "fields": { "Parameter": [ @@ -19,6 +348,13 @@ ] } }, + "examples": [ + { + "title": "Example usage:", + "content": "curl -i http://data.duraark.eu/services/api/sessions/sessions/1", + "type": "curl" + } + ], "success": { "fields": { "Success 200": [ @@ -43,6 +379,20 @@ "field": "digitalObjects", "description": "List of DigitalObjects in the Session.
" }, + { + "group": "Success 200", + "type": "Object
", + "optional": false, + "field": "config", + "description": "Configuration options for this Session to set available information topics and geometric enrichment tools.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "fixedInputFiles", + "description": "If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
" + }, { "group": "Success 200", "type": "Date
", @@ -64,35 +414,12 @@ "field": "ID", "description": "of the Session.
" } - ], - "": [ - { - "group": "SemanticMD", - "type": "Array
", - "optional": false, - "field": "topics", - "description": "List of Topics containing a set of semantic links that specify an information context.
" - }, - { - "group": "SemanticMD", - "type": "Array
", - "optional": false, - "field": "candidates", - "description": "List of semantic links related to a Topic.
" - }, - { - "group": "SemanticMD", - "type": "Array
", - "optional": false, - "field": "selections", - "description": "List of semantic links which will be connected to the DigitalObject in the SDAS knowledge graph.
" - } ] }, "examples": [ { "title": "Success-Response:", - "content": "HTTP/1.1 200 OK\n{\n \"label\": \"Haus 30\",\n \"physicalAssets\": [],\n \"digitalObjects\": [],\n \"createdAt\": [],\n \"modifiedAt\": [],\n \"id\": 1,\n}", + "content": "HTTP/1.1 200 OK\n{\n \"label\": \"Haus 30\",\n \"physicalAssets\": [],\n \"digitalObjects\": [],\n \"config\": [],\n \"fixedInputFiles\": [],\n \"createdAt\": [],\n \"modifiedAt\": [],\n \"id\": 1,\n}", "type": "json" } ] @@ -103,7 +430,7 @@ { "group": "Error 4xx", "optional": false, - "field": "SessionNotFound", + "field": "NotFound", "description": "The Session was not found.
" } ] @@ -111,12 +438,169 @@ "examples": [ { "title": "Error-Response:", - "content": "HTTP/1.1 404 Not Found\n{\n \"error\": \"SessionNotFound\"\n}", + "content": "HTTP/1.1 404 Not Found\nNot Found", "type": "json" } ] }, - "filename": "api/controllers/FilesController.js", - "groupTitle": "Session" + "filename": "api/controllers/SessionsController.js", + "groupTitle": "Session", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/sessions/:id" + } + ] + }, + { + "type": "post", + "url": "/sessions", + "title": "Create Session", + "version": "0.7.0", + "name": "PostSession", + "group": "Session", + "permission": [ + { + "name": "none" + } + ], + "description": "Creates a new Session on the server.
", + "parameter": { + "fields": { + "Parameter": [ + { + "group": "Parameter", + "type": "String
", + "optional": false, + "field": "label", + "description": "Display name of the Session.
" + }, + { + "group": "Parameter", + "type": "Array
", + "optional": false, + "field": "physicalAssets", + "description": "List of PhysicalAssets in the Session.
" + }, + { + "group": "Parameter", + "type": "Array
", + "optional": false, + "field": "digitalObjects", + "description": "List of DigitalObjects in the Session.
" + }, + { + "group": "Parameter", + "type": "Object
", + "optional": false, + "field": "config", + "description": "Configuration options for this Session to set available information topics and geometric enrichment tools.
" + }, + { + "group": "Parameter", + "type": "Array
", + "optional": false, + "field": "fixedInputFiles", + "description": "If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
" + }, + { + "group": "Parameter", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation date of the Session.
" + }, + { + "group": "Parameter", + "type": "Date
", + "optional": false, + "field": "modifiedAt", + "description": "date of the Session.
" + }, + { + "group": "Parameter", + "type": "Number
", + "optional": false, + "field": "ID", + "description": "of the Session.
" + } + ] + } + }, + "success": { + "examples": [ + { + "title": "Success-Response:", + "content": "HTTP/1.1 200 OK\n{\n \"label\": \"Haus 30\",\n \"physicalAssets\": [],\n \"digitalObjects\": [],\n \"config\": [],\n \"fixedInputFiles\": [],\n \"createdAt\": [],\n \"modifiedAt\": [],\n \"id\": 1,\n}", + "type": "json" + } + ], + "fields": { + "Success 200": [ + { + "group": "Success 200", + "type": "String
", + "optional": false, + "field": "label", + "description": "Display name of the Session.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "physicalAssets", + "description": "List of PhysicalAssets in the Session.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "digitalObjects", + "description": "List of DigitalObjects in the Session.
" + }, + { + "group": "Success 200", + "type": "Object
", + "optional": false, + "field": "config", + "description": "Configuration options for this Session to set available information topics and geometric enrichment tools.
" + }, + { + "group": "Success 200", + "type": "Array
", + "optional": false, + "field": "fixedInputFiles", + "description": "If present the WorkbenchUI will only display the files defined here. This allows to configure 'showcase' sessions.
" + }, + { + "group": "Success 200", + "type": "Date
", + "optional": false, + "field": "createdAt", + "description": "Creation date of the Session.
" + }, + { + "group": "Success 200", + "type": "Date
", + "optional": false, + "field": "modifiedAt", + "description": "date of the Session.
" + }, + { + "group": "Success 200", + "type": "Number
", + "optional": false, + "field": "ID", + "description": "of the Session.
" + } + ] + } + }, + "filename": "api/controllers/SessionsController.js", + "groupTitle": "Session", + "sampleRequest": [ + { + "url": "http://data.duraark.eu/services/api/sessions/sessions" + } + ] } ] \ No newline at end of file diff --git a/assets/api_project.js b/assets/api_project.js index bb56979..655b85a 100644 --- a/assets/api_project.js +++ b/assets/api_project.js @@ -1,17 +1,18 @@ define({ "name": "duraark-sessions", - "version": "0.6.0", + "version": "0.7.0", "title": "DURAARK Session Service", - "url": "http://juliet.cgv.tugraz.at/api/v0.7/sessions", + "url": "http://data.duraark.eu/services/api/sessions", + "sampleUrl": "http://data.duraark.eu/services/api/sessions", "order": [ - "Session" + "Session", + "File" ], "description": "Service for managing DURAARK user sessions.", - "sampleUrl": false, "apidoc": "0.2.0", "generator": { "name": "apidoc", - "time": "2015-07-25T20:30:16.728Z", + "time": "2015-08-05T16:05:51.948Z", "url": "http://apidocjs.com", "version": "0.13.1" } diff --git a/assets/api_project.json b/assets/api_project.json index b8bc6de..78c46b1 100644 --- a/assets/api_project.json +++ b/assets/api_project.json @@ -1,17 +1,18 @@ { "name": "duraark-sessions", - "version": "0.6.0", + "version": "0.7.0", "title": "DURAARK Session Service", - "url": "http://juliet.cgv.tugraz.at/api/v0.7/sessions", + "url": "http://data.duraark.eu/services/api/sessions", + "sampleUrl": "http://data.duraark.eu/services/api/sessions", "order": [ - "Session" + "Session", + "File" ], "description": "Service for managing DURAARK user sessions.", - "sampleUrl": false, "apidoc": "0.2.0", "generator": { "name": "apidoc", - "time": "2015-07-25T20:30:16.728Z", + "time": "2015-08-05T16:05:51.948Z", "url": "http://apidocjs.com", "version": "0.13.1" } diff --git a/assets/utils/send_sample_request.js b/assets/utils/send_sample_request.js index f0124bd..8bc5875 100755 --- a/assets/utils/send_sample_request.js +++ b/assets/utils/send_sample_request.js @@ -1,158 +1,158 @@ -define([ - 'jquery' -], function($) { - - var initDynamic = function() { - // Button send - $(".sample-request-send").off("click"); - $(".sample-request-send").on("click", function(e) { - e.preventDefault(); - var $root = $(this).parents("article"); - var group = $root.data("group"); - var name = $root.data("name"); - var version = $root.data("version"); - sendSampleRequest(group, name, version, $(this).data("sample-request-type")); - }); - - // Button clear - $(".sample-request-clear").off("click"); - $(".sample-request-clear").on("click", function(e) { - e.preventDefault(); - var $root = $(this).parents("article"); - var group = $root.data("group"); - var name = $root.data("name"); - var version = $root.data("version"); - clearSampleRequest(group, name, version); - }); - }; // initDynamic - - function sendSampleRequest(group, name, version, type) - { - var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]'); - - // Optional header - var header = {}; - $root.find(".sample-request-header:checked").each(function(i, element) { - var group = $(element).data("sample-request-header-group-id"); - $root.find("[data-sample-request-header-group=\"" + group + "\"]").each(function(i, element) { - var key = $(element).data("sample-request-header-name"); - var value = element.value; - header[key] = $.type(value) === "string" ? escapeHtml(value) : value; - }); - }); - - // create JSON dictionary of parameters - var param = {}; - $root.find(".sample-request-param:checked").each(function(i, element) { - var group = $(element).data("sample-request-param-group-id"); - $root.find("[data-sample-request-param-group=\"" + group + "\"]").each(function(i, element) { - var key = $(element).data("sample-request-param-name"); - var value = element.value; - param[key] = $.type(value) === "string" ? escapeHtml(value) : value; - }); - }); - - // grab user-inputted URL - var url = $root.find(".sample-request-url").val(); - - // Insert url parameter - var pattern = pathToRegexp(url, null); - var matches = pattern.exec(url); - for (var i = 1; i < matches.length; i++) { - var key = matches[i].substr(1); - if (param[key] !== undefined) { - url = url.replace(matches[i], encodeURIComponent(param[key])); - - // remove URL parameters from list - delete param[key]; - } - } // for - - // send AJAX request, catch success or error callback - $.ajax({ - url: url, - dataType: "json", - contentType: "application/json", - data: JSON.stringify(param), - headers: header, - type: type.toUpperCase(), - success: displaySuccess, - error: displayError - }); - - function displaySuccess(data) { - var jsonResponse; - try { - jsonResponse = JSON.stringify(data, null, 4); - } catch (e) { - jsonResponse = data; - } - $root.find(".sample-request-response").fadeTo(250, 1); - $root.find(".sample-request-response-json").html(jsonResponse); - refreshScrollSpy(); - }; - - function displayError(jqXHR, textStatus, error) { - var message = "Error " + jqXHR.status + ": " + error; - var jsonResponse; - try { - jsonResponse = JSON.parse(jqXHR.responseText); - jsonResponse = JSON.stringify(jsonResponse, null, 4); - } catch (e) { - jsonResponse = jqXHR.responseText; - } - - if (jsonResponse) - message += "