Description Usage Arguments Value See Also Examples
View source: R/atri_docs_upload.R
A wrapper to upload file to ATRI portal standard docs topics
1 2 3 4 5 6 7 8 9 10 |
protocol: |
The protocol name (e.g. 'a345-test-1'). |
topic_code: |
specify a topic_code to upload file into it. |
file_code: |
use file_code to overwrite a file in a topic_code. No file_code is needed when upload a new file. |
file: |
a string text for local file location. |
file_label: |
a string text for file label. |
file_description: |
a string text for file description. |
reason_for_change: |
a string text to indicate reason for change. |
site_code: |
a string text to indicate the site topic code. Required for site-restricted topics. |
atri_api object contains: response- response from http url; url- a string of complete url; protocol- a string of input protocol.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # upload new file
write.csv('test initial upload',file='test.csv')
new_upload_resp <- atri_docs_upload(protocol = "a345-test-1",
topic_code = "report-configuration",
file = "test.csv",
file_label = "Test upload function file",
file_description = "Test upload function")
# upload new file to site topic
new_upload_site_topic <- atri_docs_upload(protocol = "a345-test-1",
topic_code = "site-folder-test",
file = "test.csv",
file_label = "Test upload function file",
file_description = "Test upload function",
site_code="999")
# replace a file
write.csv('test re-upload',file='retest.csv')
topicfiles <- atri_api(protocol='a345-test-1', path='/docs/topics/report-configuration/files?format=json')
re_upload_resp <- atri_docs_upload(protocol = "a345-test-1",
topic_code = "report-configuration",
file_code = topicfiles[topicfiles$label %in% "Test upload function file", "code"],
file = "retest.csv",
reason_for_change = "test re-uploads")
# replace file to site topic
topicfiles <- atri_api(protocol='a345-test-1', path='/docs/topics/site-folder-test/files?format=json&site_code=999')
re_upload_site_topic <- atri_docs_upload(protocol = "a345-test-1",
topic_code = "site-folder-test",
file_code = topicfiles[topicfiles$label %in% "Test upload function file", "code"],
file = "retest.csv",
reason_for_change = "test re-uploads",
site_code="999")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.