Return file content
This function retrieves a file's content.
Important:
When you disable the File Storage role, the system disables this function.
Note:
JSON strings must be valid UTF-8. To retrieve a non-UTF-8 file via JSON, we recommend that you give ISO-8859-1 as from_charset and UTF-8 as to_charset, then decode the return payload’s content as UTF-8.
Query parameters
The file path to the directory that contains the selected file.
The file to retrieve.
The file’s character encoding. This parameter defaults to _DETECT_, which indicates a request to detect the file’s character encoding.
The output character encoding. This parameter defaults to _LOCALE_, which indicates a request to use the session locale’s character encoding.
Important:
Contexts that serialize the API response as JSON require this value to be utf-8 or US-ASCII. Behavior is undefined if the request indicates any other encoding.
Whether to update the file's HTML document encoding.
- 1 — Update the file's HTML document encoding.
- 0 — Don't update the file's HTML encoding.
Response
HTTP Request was successful.
Example response
{
"apiversion": 3,
"func": "get_file_content",
"module": "Fileman",
"result": {
"data": {
"content": "`hi`",
"dir": "/home/user/public_html",
"filename": "example.html",
"from_char": "UTF-8",
"path": "/home/user/public_html/example.html",
"to_char": "UTF-8"
},
"status": 1
}
}