# 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.

Endpoint: GET /Fileman/get_file_content
Version: 11.136.0.4
Security: BasicAuth

## Query parameters:

  - `dir` (string, required)
    The file path to the directory that contains the selected file.
    Example: "/home/user/public.html"

  - `file` (string, required)
    The file to retrieve.
    Example: "example.html"

  - `from_charset` (string)
    The file’s character encoding. This parameter defaults to _DETECT_, which indicates a request to detect the file’s character encoding.
    Example: "_DETECT_"

  - `to_charset` (string)
    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.
    Example: "_LOCALE_"

  - `update_html_document_encoding` (integer)
    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.
    Enum: 0, 1

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "get_file_content"

  - `module` (string)
    The name of the module called.
    Example: "Fileman"

  - `result` (object)

  - `result.data` (object)

  - `result.data.content` (string)
    The file's contents. A string value.

Note:

Behavior is undefined if the calling context
requires an encoding that conflicts with
the file contents. For example, if the file
contents are ISO-8859-1 but the context requires
UTF-8 (as is the case with JSON), the system may
apply an extra layer of UTF-8 encoding in order
to satisfy the request.
    Example: "`hi`"

  - `result.data.dir` (string)
    The absolute path to the directory that contains the selected file.
    Example: "/home/user/public_html"

  - `result.data.filename` (string)
    The file's name.
    Example: "example.html"

  - `result.data.from_char` (string)
    The file's previous character encoding. If the request’s from_charset was _DETECT_, this will contain the detected encoding. Otherwise, it will contain the request’s from_charset value.
    Example: "UTF-8"

  - `result.data.from_charset` (any)

  - `result.data.path` (string)
    The absolute path to the file.
    Example: "/home/user/public_html/example.html"

  - `result.data.to_char` (string)
    The file's new character encoding. If the request’s from_charset was _LOCALE_, this will contain the locale’s encoding. Otherwise, it will contain the request’s to_charset value.
    Example: "UTF-8"

  - `result.data.to_charset` (any)

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    - 1 - Success
- 0 - Failed: Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


