{"_id":"57b557f0d3092517007cfacd","user":"54523f0604160008005b1cc0","project":"54523fec04160008005b1cc8","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"},"__v":1,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-04T19:44:51.082Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"File Access Endpoint implemented by your system allows rollApp to download the file for editing by the user. And later, when the user is done with edits, upload updated file back to your system.\n\n## How rollApp downloads a file\n\nBefore the application is started we will download the file into the application container on one of our cloud servers. To do that we will make a `GET` request to the File Access Endpoint URL you've given.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET https://www.example.com/case/123/attachments/overview.docx\\n...\\nX-Access-Token: 1234567890\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\n`X-Access-Token` header will have the access_token value you've given us, when initiating file editing using `rollMyFile.editFile()`.\n\nThis request can be redirected by your system to another URL using `302 Moved Temporarily`.\n\n## How rollApp uploads a file\n\nWhen the file is saved by the application, rollApp will upload the updated file to the File Access Endpoint. This happens, when users saves the file in the application (e.g. by clicking File->Save, clicking the Save icon in the toolbar) or the application initiates saving of the file (e.g. through autosave) itself.\n\nThe file is uploaded using multipart `POST` request. `X-Access-Token` header will have the access_token value you've given us, when initiating file editing using `rollMyFile.editFile()`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST https://www.example.com/case/123/attachments/overview.docx\\n...\\nX-Access-Token: 1234567890\\nContent-Type: multipart/form-data; boundary=----------------------------1234567890ab\\n------------------------------1234567890ab\\nContent-Disposition: form-data; name=\\\"file\\\"; filename=\\\"overview.docx\\\"\\nContent-Type: application/octet-stream\\n<file content>\\n------------------------------1234567890ab\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"File can be saved multiple times\",\n  \"body\": \"The user or the application can save the file multiple times during file editing session. Each file saving operation will result in upload of the updated file to the File Access Endpoint.\"\n}\n[/block]","excerpt":"","slug":"rollmyfile-js-editing-file-access-endpoint","type":"basic","title":"File Access Endpoint"}

File Access Endpoint


File Access Endpoint implemented by your system allows rollApp to download the file for editing by the user. And later, when the user is done with edits, upload updated file back to your system. ## How rollApp downloads a file Before the application is started we will download the file into the application container on one of our cloud servers. To do that we will make a `GET` request to the File Access Endpoint URL you've given. [block:code] { "codes": [ { "code": "GET https://www.example.com/case/123/attachments/overview.docx\n...\nX-Access-Token: 1234567890", "language": "http" } ] } [/block] `X-Access-Token` header will have the access_token value you've given us, when initiating file editing using `rollMyFile.editFile()`. This request can be redirected by your system to another URL using `302 Moved Temporarily`. ## How rollApp uploads a file When the file is saved by the application, rollApp will upload the updated file to the File Access Endpoint. This happens, when users saves the file in the application (e.g. by clicking File->Save, clicking the Save icon in the toolbar) or the application initiates saving of the file (e.g. through autosave) itself. The file is uploaded using multipart `POST` request. `X-Access-Token` header will have the access_token value you've given us, when initiating file editing using `rollMyFile.editFile()`. [block:code] { "codes": [ { "code": "POST https://www.example.com/case/123/attachments/overview.docx\n...\nX-Access-Token: 1234567890\nContent-Type: multipart/form-data; boundary=----------------------------1234567890ab\n------------------------------1234567890ab\nContent-Disposition: form-data; name=\"file\"; filename=\"overview.docx\"\nContent-Type: application/octet-stream\n<file content>\n------------------------------1234567890ab", "language": "http" } ] } [/block] [block:callout] { "type": "info", "title": "File can be saved multiple times", "body": "The user or the application can save the file multiple times during file editing session. Each file saving operation will result in upload of the updated file to the File Access Endpoint." } [/block]