Entity Business Rules ===================== .. code-block:: http /api/repositories/{repository}/entities/{entity}/businessrules .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, The name of the :doc:`repository` to access entity, int, The ID of the :doc:`entity` .. _ebr_show_all: Show all ~~~~~~~~ .. http:get:: /api/repositories/(string:repository)/entities/(int:entityID)/businessrules :synopsis: List business rules for an entity Get a list of business rules for the :doc:`entity` .. code-block:: http GET /api/repositories/jupiter/entities/1/businessrules HTTP/1.1 Accept: application/json .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 500, Server error :ref:`Paging ` is supported for this GET request using :doc:`standard-url-query-string`. The underlying list of all the business rules for the :doc:`entity` can be returned in a :ref:`JSON key/value pair ` by setting the :ref:`external JSON format ` parameter. This allows access by different external tools that requires the JSON data in a key/value pair instead of standard array of row data with columns names defined separately. The response is a :doc:`standard-response`, with a list of all the business rules for the :doc:`entity`. If :ref:`external JSON format ` parameter was set then list of all the business rules for the :doc:`entity` in a :ref:`JSON key/value pair ` format will be returned. This list does not include attribute business rules. .. _ebr_show_some: Show Some ~~~~~~~~~ .. http:post:: /api/repositories/(string:repository)/entities/(int:entityID)/businessrules :synopsis: List business rules matching certain criteria Get a list of business rules for the :doc:`entity` that match various criteria :jsonparam body: The request body .. code-block:: http POST /api/repositories/jupiter/entities/1/businessrules HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "where": "'Actual Threshold' >= 10" } } The request requires a :doc:`standard-request` packet. see the :ref:`get command ` for the contents of the request.. The response will contain a list of rules matching the given criteria. .. _ebr_add: Add ~~~ The request requires a :doc:`standard-request` packet; see the :ref:`add command ` for the contents of the request. The response will contain the URL of the new business rule. .. _ebr_edit: Edit ~~~~ The request requires a :doc:`standard-request` packet; see the :ref:`edit command ` for the contents of the request. The response will contain the URL of the updated business rule. .. _ebr_run: Run ~~~ The run command creates a scheduled job to run the business rule(s). The request requires a :doc:`standard-request` packet; see the :ref:`run command ` for the contents of the request. The response contains the URL of the :doc:`scheduled job `. .. _ebr_delete: Delete ~~~~~~ .. http:delete:: /api/repositories/(string:repository)/entities/(int:entityID)/businessrules :synopsis: Delete multiple business rules in an entity Delete multiple business rules from the repository :jsonparam body: The request body The request body is a JSON string; the string contains a key-value pair named "RULES". The value is an array of JSON lists: .. code-block:: json { "RULES":[ { "ENTITY": "1", "ATTRIBUTE": "0", "RULE": "16" } ] } Each element in the RULES array contains the entity ID, attribute ID and rule ID of the business rule to delete. .. code-block:: http DELETE /api/repositories/jupiter/entities/1/businessrules HTTP/1.1 Content-Type: application/json { "RULES": [ { "ENTITY": "1", "ATTRIBUTE": "0", "RULE": "16" } ] } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success 400, Expected array of rules(s) within request body 400, No rule(s) found within request body 400, No data received 500, Invalid parameters 500, Server error If the delete is successful, the response will contain a URL pointing at the :doc:`entity` that owned the rule.