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.
uapi --output=jsonpretty \ --user=username \ Fileman \ get_file_content \ dir='/home/user/public_html' \ file='example.html'
{- "apiversion": 3,
- "func": "get_file_content",
- "module": "Fileman",
- "result": {
- "data": {
- "content": "`hi`",
- "dir": "/home/user/public_html",
- "filename": "example.html",
- "from_char": "UTF-8",
- "from_charset": null,
- "path": "/home/user/public_html/example.html",
- "to_char": "UTF-8",
- "to_charset": null
}, - "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}