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.
In case of an error, find the message in this list of errors.
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"."ReviewStatus" values are set from hyper's documents module, possible values are: "No Need", "Waiting", "Confirmed" and "Denied / Wrong".
{
"GetDocsTree": [
{
"FolderID": "-1",
"FolderName": "ID Docs",
"Mandatory": "Yes",
"FilesList": [
{
"Title": "im6",
"LastUpdate": "05/04/2022 10:26",
"SizeInMB": "0.14",
"FileName": "500001_000001.png",
"CanBeDeleted": "No",
"ReviewStatus": "Waiting"
},
{
"Title": "im61",
"LastUpdate": "13/04/2022 10:56",
"SizeInMB": "0.14",
"FileName": "500001_000004.png",
"CanBeDeleted": "Yes",
"Validation": "No Need"
}
]
},
{
"FolderID": "-2",
"FolderName": "106 Form",
"Mandatory": "No",
"FilesList": [
{
"Title": "img1 (1)",
"LastUpdate": "05/04/2022 10:26",
"SizeInMB": "0.11",
"FileName": "500001_000003.png",
"CanBeDeleted": "No",
"ReviewStatus": "No Need"
}
]
}
]
}
"GetDocsTree": [
{
"FolderID": "-1",
"FolderName": "ID Docs",
"Mandatory": "Yes",
"FilesList": [
{
"Title": "im6",
"LastUpdate": "05/04/2022 10:26",
"SizeInMB": "0.14",
"FileName": "500001_000001.png",
"CanBeDeleted": "No",
"ReviewStatus": "Waiting"
},
{
"Title": "im61",
"LastUpdate": "13/04/2022 10:56",
"SizeInMB": "0.14",
"FileName": "500001_000004.png",
"CanBeDeleted": "Yes",
"Validation": "No Need"
}
]
},
{
"FolderID": "-2",
"FolderName": "106 Form",
"Mandatory": "No",
"FilesList": [
{
"Title": "img1 (1)",
"LastUpdate": "05/04/2022 10:26",
"SizeInMB": "0.11",
"FileName": "500001_000003.png",
"CanBeDeleted": "No",
"ReviewStatus": "No Need"
}
]
}
]
}
Download File
Call the DOMAIN/Download_Doc_json function with "fn" (FileName) parameter, URL encoded:
DOMAIN/Download_Doc_json?fn=500001_000001.png
For successful transaction, an http file download will start immediately, the reply http headers will contain:
Content-Disposition:attachment; filename="500001_000001.png"
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=500001_000001.png
Upload File
Call the DOMAIN/Upload_Doc_json function, On Http Post ("multipart/form-data") with the following parameter:Field Name | Description |
---|---|
Target_Folder | Target folder as Integer Negative number. Accepted on "FolderID" field from "GetDocsTree_json" request |
Folder_Uid | Default Web Folder Integer Number from Hyper Settings. |
fn | Uploaded file name including extension after last dot. |
{
"ResponseCode": "000",
"ResponseMsgEng": "Success.",
"Files_In_Folder": "2",
"Filename": "500001_000004.png"
}
If any error occurs, the following message format will be received:
"ResponseCode": "000",
"ResponseMsgEng": "Success.",
"Files_In_Folder": "2",
"Filename": "500001_000004.png"
}
{"ResponseCode":"015","ResponseMsgEng":"Missing parameter \"Target_Folder\" (Negative int) for exist folder, OR \"Folder_Uid\" (Positive int) for Prototype folder ID."}
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=500001_000004.png
For successful transaction, the following message will be received:
{
"Delete_Doc": "OK",
"Filename": "500001_000004.png"
}
If any error occurs, the following message format will be received:
"Delete_Doc": "OK",
"Filename": "500001_000004.png"
}
{"ResponseCode":"018","ResponseMsgEng":"You cannot delete this file ("500001_000004.png")."}