Retrieve a Function

GET /groups/{groupId}/apps/{appId}/functions/{functionId}

Retrieve a Function.

Path parameters

Responses

  • 200 application/json

    The function was successfully retrieved.

    Hide response attributes Show response attributes object
    • _id string
    • can_evaluate object

      A JSON expression that evaluates to true if the Function is allowed to run in response to an incoming request.

    • name string Required

      A unique name for the Function.

    • private boolean Required

      If true, the function is hidden from client applications. You can still call a private function from JSON expressions and other functions, including incoming webhooks and triggers.

    • source string Required

      The stringified source code for the function. The code must be valid ES6.

    • run_as_system boolean

      If true, the function executes with full privileges, bypassing rules on all services.

    • run_as_user_id string

      An application user's account ID. If defined, endpoints will always run as the specified user. Cannot be used with run_as_user_id_script_source.

    • run_as_user_id_script_source string

      The stringified source code for a function that returns an application user's account ID. If defined, endpoints execute the function on every request and run as the user with the ID returned from the function. Cannot be used with run_as_user_id.

GET /groups/{groupId}/apps/{appId}/functions/{functionId}
curl \
 --request GET 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/functions/{functionId}' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "_id": "string",
  "can_evaluate": {},
  "name": "string",
  "private": true,
  "source": "string",
  "run_as_system": true,
  "run_as_user_id": "string",
  "run_as_user_id_script_source": "string"
}