CallSimplifiedAPI
Description
Calls a simplified M-Files API endpoint with the specified HTTP method.
NOTE: Stability is experimental. Non-backward compatible changes or removal may occur in any future release. Use of this feature is not recommended for production environments.
Syntax
// shellFrame points to instance of IShellFrame
const result = await shellFrame.CallSimplifiedAPI(
requestRelativeURL,
method,
payload,
);
Parameters
| Name | Optionality | Type | Description |
|---|---|---|---|
| requestRelativeURL | Required | string | The relative URL path of the API endpoint to call. Must start with "/" and may include a query string, but cannot include fragments, backslashes, or traversal segments. |
| method | Required | string | The HTTP method to use. Only "GET", "POST", "PUT", "PATCH", and "DELETE" are allowed. |
| payload | Optional | undefined | string | Record<string, SimplifiedAPIPayloadValue> | Optional payload to include as the request body (for POST, PUT, or PATCH requests). Either a JSON string, or an object whose own fields may hold plain JSON-serializable data and/or file content (a File, a FileList, or an array of File). When any field holds file content, the request is sent as multipart/form-data — each file-bearing field is appended under its own field name (repeated for multiple files under one field), and every other field is JSON-stringified under its own field name. |
Return type
| Type | Description |
|---|---|
Promise < any > | A promise that resolves to the parsed JSON response from the server, or rejects with an error if the HTTP request fails or response parsing fails |
Exceptions
NotSupportedError - when the CE3224_SimplifiedCoreAPISupportUIX2 feature flag is not enabled, or when called from a non-cloud vault.
Error - an error if the HTTP response status is not ok, if the request input is invalid, if the user session is unavailable, or if there is a network or parsing error