Adds a new rule to the context

POST /v1/{contextId}/rules

Adds a new rule to the context

Path parameters

  • contextId string Required

    The parent context ID, for example, "contextID1/rules" where the Rule is to be created.

application/json

Body Required

  • id string

    example:"rule_01h89qfdhbejtb3jwqq1gazbm5"

  • actions array[object]
    Hide actions attributes Show actions attributes object
    • kind string

      The name of the action example:"$set"

    • target object
      Hide target attributes Show target attributes object
      • kind string

        This is what determines the type of the id field's value example:"jsonpath" example:"myTargetKind"

      • id string

        The identifier for the target. It can be a jsonpath a simple property name or an arbitrary third party id example:"$.prop" example:"propKey" example:"target_01h89qgxe5e7wregw6gb94d5p6"

      • value string(bytes)

        The target value to be set (it is the json serialized representation of the value)

  • Hide expression attributes Show expression attributes object
    • and object
      Hide and attribute Show and attribute object
    • or object
      Hide or attribute Show or attribute object
    • A condition expression

      Hide condition attributes Show condition attributes object
      • key string

        Holds a direct object key to be used the value extraction

      • ref object

        A reference to point to third party data to be used as the value for the condition. Data retrieval requires dalí integration. Uses a dref format based on the dalí project. Stringified format: $/map[0]/prop=>/~/datasource/table/searchExpr/selectExpr Object format: { src: $/map[0]/prop, dst: /~/datasource/table/searchExpr/selectExpr }

        Hide ref attributes Show ref attributes object
      • kind string(enum)

        The type of this condition, based on the internally defined ConditionType

        Values are e, hv, eq, neq, px, npx, sx, nsx, in, nin, some, all, none, rgx, nrgx, or cel.

      • value string(bytes)

        A condition parameter holds a target value (right hand side) for a comparison

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id string

      example:"rule_01h89qfdhbejtb3jwqq1gazbm5"

    • version integer(uint64)
    • actions array[object]
      Hide actions attributes Show actions attributes object
      • kind string

        The name of the action example:"$set"

      • target object
        Hide target attributes Show target attributes object
        • kind string

          This is what determines the type of the id field's value example:"jsonpath" example:"myTargetKind"

        • id string

          The identifier for the target. It can be a jsonpath a simple property name or an arbitrary third party id example:"$.prop" example:"propKey" example:"target_01h89qgxe5e7wregw6gb94d5p6"

        • value string(bytes)

          The target value to be set (it is the json serialized representation of the value)

    • Hide expression attributes Show expression attributes object
      • and object
        Hide and attribute Show and attribute object
      • or object
        Hide or attribute Show or attribute object
      • A condition expression

        Hide condition attributes Show condition attributes object
        • key string

          Holds a direct object key to be used the value extraction

        • ref object

          A reference to point to third party data to be used as the value for the condition. Data retrieval requires dalí integration. Uses a dref format based on the dalí project. Stringified format: $/map[0]/prop=>/~/datasource/table/searchExpr/selectExpr Object format: { src: $/map[0]/prop, dst: /~/datasource/table/searchExpr/selectExpr }

          Hide ref attributes Show ref attributes object
        • kind string(enum)

          The type of this condition, based on the internally defined ConditionType

          Values are e, hv, eq, neq, px, npx, sx, nsx, in, nin, some, all, none, rgx, nrgx, or cel.

        • value string(bytes)

          A condition parameter holds a target value (right hand side) for a comparison

  • default application/json

    Default error response

    Hide response attributes Show response attributes object
    • code integer(int32)

      The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].

    • message string

      A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.

    • details array[object]

      A list of messages that carry the error details. There is a common set of message types for APIs to use.

      Hide details attributes Show details attributes object
POST /v1/{contextId}/rules
curl \
 --request POST https://api.brease.run/v1/{contextId}/rules \
 --header "Content-Type: application/json" \
 --data '{"id":"string","description":"string","actions":[{"kind":"string","target":{"kind":"string","id":"string","value":"string"}}],"expression":{"and":{"expression":[{}]},"or":{"expression":[{}]},"condition":{"key":"string","ref":{"src":"string","dst":"string","value":"string"},"kind":"e","value":"string"}}}'
Request examples
{
  "id": "string",
  "description": "string",
  "actions": [
    {
      "kind": "string",
      "target": {
        "kind": "string",
        "id": "string",
        "value": "string"
      }
    }
  ],
  "expression": {
    "and": {
      "expression": [
        {}
      ]
    },
    "or": {
      "expression": [
        {}
      ]
    },
    "condition": {
      "key": "string",
      "ref": {
        "src": "string",
        "dst": "string",
        "value": "string"
      },
      "kind": "e",
      "value": "string"
    }
  }
}
Response examples (200)
{
  "id": "string",
  "version": 42,
  "description": "string",
  "actions": [
    {
      "kind": "string",
      "target": {
        "kind": "string",
        "id": "string",
        "value": "string"
      }
    }
  ],
  "expression": {
    "and": {
      "expression": [
        {}
      ]
    },
    "or": {
      "expression": [
        {}
      ]
    },
    "condition": {
      "key": "string",
      "ref": {
        "src": "string",
        "dst": "string",
        "value": "string"
      },
      "kind": "e",
      "value": "string"
    }
  }
}
Response examples (default)
{
  "code": 42,
  "message": "string",
  "details": [
    {
      "@type": "string"
    }
  ]
}