{"_id":"54523fec04160008005b1cce","category":{"_id":"546458255871e90800f5014e","__v":5,"pages":["546467902c77331a00252bb8","54646990f42a472000b0c4b2","546469adf42a472000b0c4b4","546469f0f42a472000b0c4b7","546a2a51a3b67a0e00559c18"],"version":"54523fec04160008005b1ccb","project":"54523fec04160008005b1cc8","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-11-13T07:05:09.147Z","from_sync":false,"order":0,"slug":"rollmyfile-javascript-api","title":"rollMyFile JavaScript API"},"project":"54523fec04160008005b1cc8","version":{"_id":"54523fec04160008005b1ccb","project":"54523fec04160008005b1cc8","__v":3,"createdAt":"2014-10-30T13:41:00.515Z","releaseDate":"2014-10-30T13:41:00.515Z","categories":["54523fec04160008005b1ccc","546458255871e90800f5014e","56117ff28c76a61900fd06d5"],"is_deprecated":true,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":18,"is_link":false,"githubsync":"","user":"54523f0604160008005b1cc0","updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-30T13:41:00.558Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","try":true,"basic_auth":false,"auth":"never","params":[],"url":""},"isReference":false,"order":0,"body":"[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"API Is Still In Beta\",\n \"body\": \"At this time API is not open for use by everybody. If you are interested in early access, please drop us a note at [support:::at:::rollapp.com][1] and we will be happy to let you in and show around.\\n\\n[1]: mailto:support@rollapp.com\"\n}\n[/block]\n# Using rollMyFile API in JavaScript\n\nOn a page, where you want to let users open files, you simply do the following\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"<script type=\\\"text/javascript\\\" src=\\\"https://api.rollapp.com/1/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 all it takes to open a file is \n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"rollMyFile.openFileByUrl(\\\"https://www.example.com/documentation/overview.docx\\\");\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]","excerpt":"This page will help you get started with rollMyFile JavaScript API to open hundreds of different file types on the Web.","slug":"rollmyfile-js-api","type":"basic","title":"Introduction"}

rollMyFile Editing JavaScript API

Introduction

This page will help you get started with rollMyFile JavaScript API to open hundreds of different file types on the Web.

[block:callout]
{
"type": "warning",
"title": "API Is Still In Beta",
"body": "At this time API is not open for use by everybody. If you are interested in early access, please drop us a note at [support@rollapp.com][1] and we will be happy to let you in and show around.\n\n[1]: mailto:support@rollapp.com"
}
[/block]
# Using rollMyFile API in JavaScript
On a page, where you want to let users open files, you simply do the following
[block:code]
{
"codes": [
{
"code": "<script type=\"text/javascript\" src=\"https://api.rollapp.com/1/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 all it takes to open a file is
[block:code]
{
"codes": [
{
"code": "rollMyFile.openFileByUrl(\"https://www.example.com/documentation/overview.docx\");",
"language": "javascript"
}
]
}
[/block]