path パラメータ
-
Atlas Project/Group ID。
-
アプリケーションの ObjectID。App Services API プロジェクトとアプリケーション ID のセクションでは、この値を見つける方法が示されています。
body
必須
作成する関数
-
受信リクエストに応じて関数の実行が許可されている場合に
true
と評価される JSON 式。 -
関数のユニークな名前。
-
true
の場合、関数はクライアント アプリケーションから非表示になります。受信 Webhook や Triggers などの JSON 式やその他の関数からプライベート関数を呼び出すこともできます。 -
関数の文字列化されたソースコード。コードは有効な ES6 である必要があります。
-
true
の場合、関数はすべてのサービスに対するルールをバイパスして完全な権限で実行されます。 -
アプリケーション ユーザーのアカウントID。定義されている場合、エンドポイントは常に指定されたユーザーとして実行されます。
run_as_user_id_script_source
とは併用できません。 -
アプリケーションユーザーのアカウントIDを返す関数の文字列化されたソースコード。定義されている場合、エンドポイントはリクエストごとに関数を実行し、関数から返されたIDを持つユーザーとして実行されます。
run_as_user_id
とは併用できません。
POST /groups/{groupId}/apps/{appId}/functions
curl \
--request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/functions' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"can_evaluate":{},"name":"string","private":true,"source":"string","run_as_system":true,"run_as_user_id":"string","run_as_user_id_script_source":"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"
}
応答の例(201)
{
"_id": "string",
"name": "string"
}