创建规则 已弃用

发布 /groups/{groupId}/apps/{appId}/services/{serviceId}/rules

路径参数

application/json

body 对象 必需

要创建的规则。

以下之一:

响应

  • 201 application/json

    已成功创建。

    隐藏响应属性 显示响应属性 对象
    • _id 字符串
    • 名称 字符串
  • 409

    已经有一项规则使用给定的 name

POST /groups/{groupId}/apps/{appId}/services/{serviceId}/rules
curl \
 --request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/services/{serviceId}/rules' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"_id":"string","roles":[{"_id":"string","document_filters":{"read":{},"write":{}},"name":"string","apply_when":{},"read":{},"write":{},"insert":{},"delete":{},"search":{},"fields":{},"additional_fields":{"read":{},"write":{}}}],"filters":[{"_id":"string","name":"string","apply_when":{},"query":{},"projection":{"additionalProperty1":0,"additionalProperty2":0}}],"database":"string","collection":"string"}'
请求示例
{
  "_id": "string",
  "roles": [
    {
      "_id": "string",
      "document_filters": {
        "read": {},
        "write": {}
      },
      "name": "string",
      "apply_when": {},
      "read": {},
      "write": {},
      "insert": {},
      "delete": {},
      "search": {},
      "fields": {},
      "additional_fields": {
        "read": {},
        "write": {}
      }
    }
  ],
  "filters": [
    {
      "_id": "string",
      "name": "string",
      "apply_when": {},
      "query": {},
      "projection": {
        "additionalProperty1": 0,
        "additionalProperty2": 0
      }
    }
  ],
  "database": "string",
  "collection": "string"
}
{
  "name": "string",
  "actions": [
    "string"
  ],
  "when": {}
}
响应示例 (201)
{
  "_id": "string",
  "name": "string"
}