Enable the Data API

POST /groups/{groupId}/apps/{appId}/data_api/config

Create your app's Data API configuration.

Path parameters

application/json

Body Required

A valid configuration object for the endpoint.

  • disabled boolean Required
  • versions array[string] Required

    A supported version of the Data API.

    Value is v1.

  • return_type string Required

    A data format supported by the Data API & custom endpoints.

    Values are JSON or EJSON.

  • create_user_on_auth boolean
  • run_as_user_id string

    An application user's account ID. If defined, endpoints will always run as the specified user.

  • run_as_user_id_script_source string

    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.

  • validation_method string Required

    Values are NO_VALIDATION, SECRET_AS_QUERY_PARAM, or VERIFY_PAYLOAD.

  • secret_name string

    If validation_method is set to "SECRET_AS_QUERY_PARAM" or "VERIFY_PAYLOAD", this is the name of the Secret that authorizes requests.

  • can_evaluate object

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

Responses

  • 201 application/json

    Created

    Hide response attributes Show response attributes object | null
    • disabled boolean Required
    • versions array[string] Required

      A supported version of the Data API.

      Value is v1.

    • return_type string Required

      A data format supported by the Data API & custom endpoints.

      Values are JSON or EJSON.

    • create_user_on_auth boolean
    • run_as_user_id string

      An application user's account ID. If defined, endpoints will always run as the specified user.

    • run_as_user_id_script_source string

      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.

    • validation_method string Required

      Values are NO_VALIDATION, SECRET_AS_QUERY_PARAM, or VERIFY_PAYLOAD.

    • secret_name string

      If validation_method is set to "SECRET_AS_QUERY_PARAM" or "VERIFY_PAYLOAD", this is the name of the Secret that authorizes requests.

    • can_evaluate object

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

POST /groups/{groupId}/apps/{appId}/data_api/config
curl \
 --request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/data_api/config' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"disabled":true,"versions":["v1"],"return_type":"JSON","create_user_on_auth":true,"run_as_user_id":"string","run_as_user_id_script_source":"string","validation_method":"NO_VALIDATION","secret_name":"string","can_evaluate":{}}'
Request examples
{
  "disabled": true,
  "versions": [
    "v1"
  ],
  "return_type": "JSON",
  "create_user_on_auth": true,
  "run_as_user_id": "string",
  "run_as_user_id_script_source": "string",
  "validation_method": "NO_VALIDATION",
  "secret_name": "string",
  "can_evaluate": {}
}
Response examples (201)
{
  "disabled": true,
  "versions": [
    "v1"
  ],
  "return_type": "JSON",
  "create_user_on_auth": true,
  "run_as_user_id": "string",
  "run_as_user_id_script_source": "string",
  "validation_method": "NO_VALIDATION",
  "secret_name": "string",
  "can_evaluate": {}
}