Documents API
This is the API of the Documents page, which is built from 4 functions.Use http post to pass the fields into the functions. Response returned as json string.
In order to start using the Documents API, call the DOMAIN/GetDocsTree_json url, it will return the folders and files list.
To upload a new file, call DOMAIN/Upload_Doc_json url.
To download file from the list, call DOMAIN/Download_Doc_json url.
To delete a file that was uploaded in the current session, call DOMAIN/Delete_Doc_json url.
Get Folders and Files list
Call the DOMAIN/GetDocsTree_json function simply with Http Get, without input parameters.Function Output Sample
The function will return a Tree Structured json string, Starting with base array object "GetDocsTree"."Validation" values are set from hyper's documents module, possible values are: "New", "Delay", "Accepted" and "Rejected".
{
"GetDocsTree": [
{
"FolderName": "Signed Contract",
"FilesList": [
{
"Title": "Terms of Use",
"LastUpdate": "11/07/2016 16:09",
"SizeInMB": "0.04",
"FileName": "500023_000001_M.B Medical LTD.docx",
"CanBeDeleted": "No"
"Validation": "Accepted"
},
{
"Title": "images",
"LastUpdate": "11/07/2016 16:11",
"SizeInMB": "0.01",
"FileName": "500023_000005_M.B Medical LTD.jpg",
"CanBeDeleted": "No"
"Validation": "New"
}}
]
},
{
"FolderName": "Identification Documents",
"FilesList": [
{
"Title": "Unlimited time authorization for using the license",
"LastUpdate": "11/07/2016 16:09",
"SizeInMB": "0.01",
"FileName": "500023_000002_M.B Medical LTD.docx",
"CanBeDeleted": "No"
"Validation": "Rejected"
},
{
"Title": "SYE logo in medium size",
"LastUpdate": "11/07/2016 16:11",
"SizeInMB": "0.14",
"FileName": "500023_000003_M.B Medical LTD.png",
"CanBeDeleted": "No"
"Validation": "Delay"
},
{
"Title": "SYE logo in small size",
"LastUpdate": "11/07/2016 16:11",
"SizeInMB": "0.04",
"FileName": "500023_000004_M.B Medical LTD.png",
"CanBeDeleted": "No"
"Validation": "New"
}
]
}
]
}
"GetDocsTree": [
{
"FolderName": "Signed Contract",
"FilesList": [
{
"Title": "Terms of Use",
"LastUpdate": "11/07/2016 16:09",
"SizeInMB": "0.04",
"FileName": "500023_000001_M.B Medical LTD.docx",
"CanBeDeleted": "No"
"Validation": "Accepted"
},
{
"Title": "images",
"LastUpdate": "11/07/2016 16:11",
"SizeInMB": "0.01",
"FileName": "500023_000005_M.B Medical LTD.jpg",
"CanBeDeleted": "No"
"Validation": "New"
}}
]
},
{
"FolderName": "Identification Documents",
"FilesList": [
{
"Title": "Unlimited time authorization for using the license",
"LastUpdate": "11/07/2016 16:09",
"SizeInMB": "0.01",
"FileName": "500023_000002_M.B Medical LTD.docx",
"CanBeDeleted": "No"
"Validation": "Rejected"
},
{
"Title": "SYE logo in medium size",
"LastUpdate": "11/07/2016 16:11",
"SizeInMB": "0.14",
"FileName": "500023_000003_M.B Medical LTD.png",
"CanBeDeleted": "No"
"Validation": "Delay"
},
{
"Title": "SYE logo in small size",
"LastUpdate": "11/07/2016 16:11",
"SizeInMB": "0.04",
"FileName": "500023_000004_M.B Medical LTD.png",
"CanBeDeleted": "No"
"Validation": "New"
}
]
}
]
}
Download File
Call the DOMAIN/Download_Doc_json function with "fn" (FileName) parameter, URL encoded:
DOMAIN/Download_Doc_json?fn=500023_000001_M.B Medical LTD.docx
For successful transaction, an http file download will start immediately, the reply http headers will contain:
Content-Disposition:attachment; filename="500023_000001_M.B Medical LTD.docx"
If any error occurs, the following message format will be received:
{"ResponseCode":"007","ResponseMsgEng":"Please fill up all the required fields."}
When building a mobile application, you will probably need a simple link to a file.
Here is a tip: Use the standard Download_Doc with "SessionID" parameter along with the "fn". Do not forget to use UTF-8 and URL encoding...
For example:
http://DOMAIN/Download_Doc?sessionid=BA00205E73488D81A60E4078&fn=500023_000002_M.B%20Medical%20LTD.jpg
Upload File
Call the DOMAIN/Upload_Doc_json function, On Http Post ("multipart/form-data") with the following parameter:Field Name | Description |
---|---|
Category | Target folder name, should be the exact value of "FolderName" field from GetDocsTree. |
uploaded_file | Uploaded file name including extension after last dot. |
{"Upload_Doc":"OK","Filename":"500023_000001_M.B Medical LTD.docx"}
If any error occurs, the following message format will be received:
{"ResponseCode":"017","ResponseMsgEng":"You cannot upload files where the size is more then 50 mega bytes."}
Undo Upload
To delete a file that was uploaded in the current session, Call the DOMAIN/Delete_Doc_json function with "fn" (FileName) parameter, URL encoded:
DOMAIN/Delete_Doc_json?fn=500023_000001_M.B Medical LTD.docx
For successful transaction, the following message will be received:
{"Delete_Doc":"OK","Filename":"500023_000001_M.B Medical LTD.docx"}
If any error occurs, the following message format will be received:
{"ResponseCode":"015","ResponseMsgEng":"You cannot delete this file (\"500023_000001_M.B Medical LTD.docx\")."}
Functions Error Messages
Response Code | Message in English |
---|---|
3 | API function does not exists. |
4 | Database Error on server side. |
5 | Technical Error on server side. |
6 | Technical Error: Client Session not found. |
7 | Please fill up all the required fields. |
15 | You cannot delete this file ("Filename"). |
16 | You cannot upload files with an Extension other then: JPG,JPEG,PNG,PDF,TIF,TIFF,DOC/X |
17 | You cannot upload files where the size is more then 50 mega bytes. |