Icon Web Server Administration API - Files

Any file names used in the file management portion of the administration API can refer to one of several virtual resource names:

Virtual ResourceDescription
ContentStatic content virtual resource
ModulesNative server modules virtual resource
ApplicationsServer applications virtual resource
LogsLogs virtual resource

Information These virtual resource names are only used with the administration API and should not to be confused with the resource names that are configured in the web server for request routing.

The virtual resource name should be the first portion of the file name path, and should use Unix/Web style path delimiters:

<Origin>/<Virtual Resource>[/<Folder>][/<File>]

<Origin> = <Protocol>://<Domain>[:<Port>]

<Virtual Resource> = Virtual resource name

                         Content
                         Modules
                         Applications
                         Logs

<Folder> = Folder name, if specified

<File> = File Name, if specified


File Modified Request
The file modified request returns whether the file provided in the included JSON content has been modified. The file name is a URL path that should begin with a virtual resource name and may contain sub-folders, but must refer to an existing valid file already present on the web server. The size and last modified properties are used to determine if the file has been modified. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: GET

HTTP Request Content Type: application/json; charset=utf-8
HTTP Response Content Type: application/json; charset=utf-8

Example Request:

https://localhost/administration?method=filemodified

Example Request Content:

{
   "Name": "\/Content\/musiccollection.html",
   "Size": 173678,
   "LastModified": 1607220954332
}

Example Response Content:

{
   "Modified": false
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Upload File Request
The upload file request is a multi-part, mixed request that uploads the file provided in the included JSON content. The file name is a URL path that should begin with a virtual resource name and may contain sub-folders, but must refer to a valid path for the uploaded file. The offset propety is used to perform a very large file upload in chunks without exceeding the maximum request size configured for the web server. For example, the default file chunk size used by the IDE for file uploads is 16MB. The size and last modified properties are assigned to the file once it has been completely written to the target path. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: POST

HTTP Request Content Type: multipart/mixed; boundary=<Content Boundary>

Example Request:

https://localhost/administration?method=uploadfile

Example Request Content:

--85E52D200059154CADE514918E72C9
Content-Type: application/json; charset=utf-8

{
   "Name": "\/Content\/musiccollection.html",
   "Size": 173678,
   "LastModified": 1607220954332,
   "Offset": 0
}
--85E52D200059154CADE514918E72C9
Content-Type: text/html
Content-Disposition: attachment; filename="/Content/musiccollection.html"

<!doctype html>
<html>
<head>
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
   <meta name="application-name" content="Music Collection Client Application">
   <meta name="application-version" content="1.00">
   <meta name="application-load-progress" content="False">
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <meta http-equiv="Content-Style-Type" content="text/css">
   <meta http-equiv="Content-Script-Type" content="text/javascript">
<body>
</body>
</html>
--85E52D200059154CADE514918E72C9--

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Upload Resource Request
The upload resource request is a multi-part, mixed request that uploads the virtual resource provided in the included JSON content as a .zip file. The .zip file is first unzipped and each file/folder is processed independently as a separate file upload in a similar manner to the upload file request. The offset propety is used to perform a very large file upload in chunks without exceeding the maximum request size configured for the web server. For example, the default file chunk size used by the IDE for file uploads is 16MB. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: POST

HTTP Request Content Type: multipart/mixed; boundary=<Content Boundary>

Example Request:

https://localhost/administration?method=uploadresource

Example Request Content:

--591265089C5596441D169D4B2D62A5
Content-Type: application/json; charset=utf-8'

{
   "Name": "Content",
   "Size": 67516340,
   "Offset": 0
}
--591265089C5596441D169D4B2D62A5
Content-Type: application/x-zip-compressed

<Binary ZIP File Content>
--591265089C5596441D169D4B2D62A5--

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Download Files Request
The download files request downloads the files provided in the included JSON content as a .zip file. The offset propety is used to perform a very large file upload in chunks without exceeding the maximum request size configured for the web server. For example, the default file chunk size used by the IDE for file uploads is 16MB. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: GET

HTTP Request Content Type: application/json; charset=utf-8
HTTP Response Content Type: application/x-zip-compressed

Example Request:

https://localhost/administration?method=downloadfiles

Example Request Content:

{
   "Files": ["\/Logs\/System\/20200725.elog",
             "\/Logs\/System\/20200727.elog",
             "\/Logs\/System\/20200724.elog",
             "\/Logs\/System\/20200723.elog",
             "\/Logs\/System\/20200722.elog",
             "\/Logs\/System\/20200721.elog"]
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Rename File Request
The remame file request renames the file provided in the included JSON content to a new name. The file name is a URL path that should begin with a virtual resource name and may contain sub-folders, but must refer to an existing valid file already present on the web server. The new file name should not contain any path information. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: POST

HTTP Request Content Type: application/json; charset=utf-8

Example Request:

https://localhost/administration?method=renamefile

Example Request Content:

{
   "Name": "\/Content\/computer.png",
   "NewName": "pc.png"
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Remove File Request
The remove file request removes the file provided in the included JSON content. The file name is a URL path that should begin with a virtual resource name and may contain sub-folders, but must refer to an existing valid file already present on the web server. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: POST

HTTP Request Content Type: application/json; charset=utf-8

Example Request:

https://localhost/administration?method=removefile

Example Request Content:

{
   "Name": "\/Content\/computer.png"
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Create Folder Request
The create folder request creates the folder provided in the included JSON content. The folder is a URL path that should begin with a virtual resource name and may contain sub-folders, but must refer to a valid path for the new folder. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: POST

HTTP Request Content Type: application/json; charset=utf-8

Example Request:

https://localhost/administration?method=createfolder

Example Request Content:

{
   "Name": "\/Content\/Images"
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Rename Folder Request
The remame folder request renames the folder provided in the included JSON content to a new name. The folder is a URL path that should begin with a virtual resource name and may contain sub-folders, but must refer to an existing valid path already present on the web server. The new folder name should not contain any path information. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: POST

HTTP Request Content Type: application/json; charset=utf-8

Example Request:

https://localhost/administration?method=renamefolder

Example Request Content:

{
   "Name": "\/Content\/Images",
   "NewName": "Img"
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Remove Folder Request
The remove folder request removes the folder provided in the included JSON content. The folder is a URL path that should begin with a virtual resource name and may contain sub-folders, but must refer to an existing valid path already present on the web server. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: POST

HTTP Request Content Type: application/json; charset=utf-8

Example Request:

https://localhost/administration?method=removefolder

Example Request Content:

{
   "Name": "\/Content\/Images"
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error


Get Files Request
The get applications request enumerates all of the files in the file specification provided in the included JSON content. The file specification should begin with a virtual resource name and may contain sub-folders, but must refer to an existing valid path already present on the web server. If there is no active session or the session is not authenticated, the request will result in a 403 Forbidden HTTP response.

HTTP Method: GET

HTTP Request Content Type: application/json; charset=utf-8
HTTP Response Content Type: application/json; charset=utf-8

Example Request:

https://localhost/administration?method=getfiles

Example Request Content:

{
   "Name": "\/Applications\/*.*"
}

Example Response Content:

{
   "Name": "Applications",
   "Files": [{ "Name": "excepttest.wba",
               "Size": 62245,
               "LastModified": 1597457504313 },
             { "Name": "musiccollection.wba",
               "Size": 78450,
               "LastModified": 1603738472323 },
             { "Name": "NewServerTest",
               "Files": [{ "Name": "project1.wba",
                           "Size": 54571,
                           "LastModified": 1595372868000 }] },
             { "Name": "photoalbum.wba",
                "Size": 64533,
                "LastModified": 1599675169367 },
             { "Name": "project1.wba",
               "Size": 66356,
               "LastModified": 1594945532641 },
             { "Name": "ServerApp",
               "Files": [{ "Name": "serverapp.wba",
                           "Size": 70798,
                           "LastModified": 1595372868000 }] }]
}

HTTP Response: 200 on success, 403 if not authenticated, and 500 on error
Image