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.
dir required | string <path> The file path to the directory that contains the selected file. Example: dir=/home/user/public.html |
file required | string The file to retrieve. Example: file=example.html |
from_charset | string Default: "_DETECT_" The file’s character encoding. This parameter defaults to Example: from_charset=_DETECT_ |
to_charset | string Default: "_LOCALE_" The output character encoding. This parameter defaults to Important: Contexts that serialize the API response as JSON require
this value to be Example: to_charset=_LOCALE_ |
update_html_document_encoding | integer Default: 1 Whether to update the file's HTML document encoding.
Example: update_html_document_encoding=1 |
apiversion | integer The version of the API. |
func | string The name of the method called. |
module | string The name of the module called. |
object |
uapi --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
}
}