{"_id":"57b557f0d3092517007cfacc","githubsync":"","project":"54523fec04160008005b1cc8","__v":1,"user":"54523f0604160008005b1cc0","version":{"_id":"57b557f0d3092517007cfac3","project":"54523fec04160008005b1cc8","__v":2,"createdAt":"2016-08-18T06:38:40.018Z","releaseDate":"2016-08-18T06:38:40.018Z","categories":["57b557f0d3092517007cfac4","57b557f0d3092517007cfac5","59c4d73c5237e3003c4532c3"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"category":{"_id":"57b557f0d3092517007cfac5","__v":0,"version":"57b557f0d3092517007cfac3","project":"54523fec04160008005b1cc8","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-10-04T19:37:22.236Z","from_sync":false,"order":1,"slug":"rollmyfile-editing-javascript-api","title":"rollMyFile Editing JavaScript API"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-04T19:39:04.471Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"# Using rollMyFile API to edit files\n\nIt is no more complex than opening files for viewing. However, it requires your web application to be ready to accept file updated by the user. To do that you need to implement [file access endpoint](doc:rollmyfile-js-editing-file-access-endpoint). \n\nOn a page, where you want to let users edit files stored in your web application, you simply do the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script type=\\\"text/javascript\\\" src=\\\"https://api.rollapp.com/2/js/rollmyfile.js\\\"></script>\\n\\n<script type=\\\"text/javascript\\\">\\n    var key = \\\"SeCur3AP1K3y\\\";\\n\\n    var rollMyFile = new RollMyFile(key);\\n</script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nAnd then, if your file access endpoint is ready, all it takes to edit a file is \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"rollMyFile.editFile(\\\"https://www.example.com/case/123/attachments/overview.docx\\\");\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nUser will not be allowed to save file with different name or to a different location. In applications, which support operation like File->Save As, access to this function will be blocked.","excerpt":"","slug":"rollmyfile-js-editing-api","type":"basic","title":"Introduction"}
# Using rollMyFile API to edit files It is no more complex than opening files for viewing. However, it requires your web application to be ready to accept file updated by the user. To do that you need to implement [file access endpoint](doc:rollmyfile-js-editing-file-access-endpoint). On a page, where you want to let users edit files stored in your web application, you simply do the following: [block:code] { "codes": [ { "code": "<script type=\"text/javascript\" src=\"https://api.rollapp.com/2/js/rollmyfile.js\"></script>\n\n<script type=\"text/javascript\">\n var key = \"SeCur3AP1K3y\";\n\n var rollMyFile = new RollMyFile(key);\n</script>", "language": "html" } ] } [/block] And then, if your file access endpoint is ready, all it takes to edit a file is [block:code] { "codes": [ { "code": "rollMyFile.editFile(\"https://www.example.com/case/123/attachments/overview.docx\");", "language": "javascript" } ] } [/block] User will not be allowed to save file with different name or to a different location. In applications, which support operation like File->Save As, access to this function will be blocked.