HydraCore
API by router

Rule templates

List Templates

GET
/v1/rule-templates
AuthorizationBearer <token>

In: header

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X GET "https://loading/v1/rule-templates" \  -H "X-Api-Key: string"
[
  {
    "created_at": "2019-08-24T14:15:22Z",
    "description": "string",
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "is_active": true,
    "name": "string",
    "rules": [
      {}
    ],
    "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
    "updated_at": "2019-08-24T14:15:22Z",
    "version": 0
  }
]
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Create Template

POST
/v1/rule-templates
AuthorizationBearer <token>

In: header

Header Parameters

X-Api-Key?X-Api-Key
description?Description
nameName
Lengthlength <= 200
rulesRules

Response Body

curl -X POST "https://loading/v1/rule-templates" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "rules": [      {        "name": "string",        "trigger_event": "string"      }    ]  }'
{
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "is_active": true,
  "name": "string",
  "rules": [
    {}
  ],
  "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
  "updated_at": "2019-08-24T14:15:22Z",
  "version": 0
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Get Template

GET
/v1/rule-templates/{template_id}
AuthorizationBearer <token>

In: header

Path Parameters

template_idTemplate Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X GET "https://loading/v1/rule-templates/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "X-Api-Key: string"
{
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "is_active": true,
  "name": "string",
  "rules": [
    {}
  ],
  "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
  "updated_at": "2019-08-24T14:15:22Z",
  "version": 0
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Delete Template

DELETE
/v1/rule-templates/{template_id}
AuthorizationBearer <token>

In: header

Path Parameters

template_idTemplate Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X DELETE "https://loading/v1/rule-templates/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "X-Api-Key: string"
Empty
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Update Template

PUT
/v1/rule-templates/{template_id}
AuthorizationBearer <token>

In: header

Path Parameters

template_idTemplate Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key
description?Description
is_active?Is Active
name?Name
rules?Rules

Response Body

curl -X PUT "https://loading/v1/rule-templates/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "is_active": true,
  "name": "string",
  "rules": [
    {}
  ],
  "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
  "updated_at": "2019-08-24T14:15:22Z",
  "version": 0
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

List Applications

GET
/v1/rule-templates/{template_id}/applications
AuthorizationBearer <token>

In: header

Path Parameters

template_idTemplate Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X GET "https://loading/v1/rule-templates/497f6eca-6276-4993-bfeb-53cbbbba6f08/applications" \  -H "X-Api-Key: string"
[
  {
    "applied_at": "2019-08-24T14:15:22Z",
    "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
    "template_version": 0
  }
]
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Apply Template

Apply a rule template to a customer.

Creates BusinessRule rows from the template's rule definitions. Rules with rule_key that already exist for the customer are skipped (customer may have overrides). Rules without rule_key are always created.

Owen F5 (boundary on body.customer_id): pre-fix only verify_customer_in_tenant ran, which checks tenant scope but not customer-boundary. A within-customer admin in customer A could apply a tenant template to customer B's account by passing body.customer_id=B. Now enforce_customer_scope runs first.

POST
/v1/rule-templates/{template_id}/apply
AuthorizationBearer <token>

In: header

Path Parameters

template_idTemplate Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key
customer_idCustomer Id
Formatuuid

Response Body

curl -X POST "https://loading/v1/rule-templates/497f6eca-6276-4993-bfeb-53cbbbba6f08/apply" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{    "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e"  }'
{
  "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
  "rules_created": 0,
  "rules_skipped": 0,
  "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}