Business Rules ============== .. code-block:: http /api/repositories/{repository}/businessrules .. csv-table:: :header: Parameter, Type, Purpose :widths: 20, 20, 60 :stub-columns: 1 repository, string, The name of the :doc:`repository` to access .. _br_count: Count ~~~~~~~~ .. http:get:: /api/repositories/(string:repository)/businessrules/count :synopsis: Get the number of business rules in the repository Returns the number of business rules in the repository. .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 500, Server error The response contains the number of business rules in the repository. .. code-block:: json { "count": "426" } .. _ebr_count: Entity Business Rule Count ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. http:get:: /api/repositories/(string:repository)/businessrules/entity/count :synopsis: Get the number of business rules in the repository Returns the number of business rules in the repository that are associated to an entity. .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 500, Server error The response contains the number of business rules in the repository that are associated to an entity. .. code-block:: json { "count": "21" } List All Business Rules ~~~~~~~~~~~~~~~~~~~~~~~ List all library and non-library business rules. Get --- .. http:get:: /api/repositories/(string:repository)/businessrules :synopsis: List all library and non-library business rules in the repository Get a list of all library and non-library business rules in the :doc:`repository`. :ref:`Paging ` is supported for this GET request using :doc:`standard-url-query-string`. If you require a subset of this data (filtering, sorting, or columns), POST to this url with the :doc:`standard request ` body. .. code-block:: http GET /api/repositories/jupiter/businessrules HTTP/1.1 Accept: application/json .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error 500, Server error The underlying data rows 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 library and non-library business rules in the :doc:`repository`; this includes Entity business rules and Attribute business rules. If :ref:`external JSON format ` parameter was set then the row details of the business rule will be returned in a :ref:`JSON key/value pair ` format. Post ---- .. http:post:: /api/repositories/(string:repository)/businessrules :synopsis: List all library and non-library business rules in the repository matching certain criteria Get a list of all library and non-library business rules in the :doc:`repository` that match various criteria :jsonparam body: The request body .. code-block:: http POST /api/repositories/jupiter/businessrules HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "where": "'Actual Threshold' >= 10" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success 400, Invalid request body 400, Invalid command 400, No data received 500, Server error The request requires a :doc:`standard-request` packet. The underlying row data of business rules 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. Available commands are: .. csv-table:: :header: Command, Description :widths: 20, 80 get, Get business rules from the :doc:`repository` that match the criteria in Options The response is a :doc:`standard-response`, with a list of all library and non-library business rules in the :doc:`repository`; this includes Entity business rules and Attribute business rules matching the given criteria. If :ref:`external JSON format ` parameter was set then the details of the business rule will be returned in a :ref:`JSON key/value pair ` format. Entity (non-library) Business Rules ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get --- .. http:get:: /api/repositories/(string:repository)/businessrules/entity :synopsis: List all non-library business rules in the repository Get a list of all non-library business rules in the :doc:`repository`. The GET request supports page and pageSize parameters on the URL. If you require a subset of this data (filtering, sorting, or columns), POST to this url with the :doc:`standard request ` body. .. code-block:: http GET /api/repositories/jupiter/businessrules/entity 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 data rows 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 non-library business rules in the :doc:`repository`; this includes Entity business rules and Attribute business rules. If :ref:`external JSON format ` parameter was set then the details of the business rule will be returned in a :ref:`JSON key/value pair ` format. Commands -------- .. http:post:: /api/repositories/(string:repository)/businessrules/entity :synopsis: List non-library business rules matching certain criteria Get a list of non-library business rules in the :doc:`repository` that match various criteria :jsonparam body: The request body .. code-block:: http POST /api/repositories/jupiter/businessrules/entity HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "where": "'Actual Threshold' >= 10" } } .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success 400, Invalid request body 400, No rule details given 400, Invalid command 400, No data received 500, Server error The request requires a :doc:`standard-request` packet. The underlying row data of business rules can be returned in a :ref:`JSON key/value pair ` by setting the :ref:`external JSON format ` parameter for the ``get`` command. 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. Available commands are: .. csv-table:: :header: Command, Description :widths: 20, 80 get, Get business rules from the :doc:`repository` that match the criteria in Options add, Add a :doc:`businessrule` edit, Edit a :doc:`businessrule` run, Run the :doc:`businessrule` analysis See the :doc:`businessrule-commands` for the contents of the request for each command. The response depends on which operation was performed. .. csv-table:: :header: Command, Response :widths: 20, 80 get, A :doc:`standard-response` with a list of the rules matching the given criteria add, Returns the URL of the newly added :doc:`businessrule` edit, Returns the URL of the updated :doc:`businessrule` run, Returns the URL of the :doc:`job` Delete ------ .. http:delete:: /api/repositories/(string:repository)/businessrules/entity :synopsis: Delete multiple non-library business rules from the repository Delete multiple non-library business rules from the :doc:`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 :doc:`entity` ID, attribute ID and :doc:`businessrule` ID of the rule to delete. .. code-block:: http DELETE /api/repositories/jupiter/businessrules/entity 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. Library Business Rules ~~~~~~~~~~~~~~~~~~~~~~ Get --- .. http:get:: /api/repositories/(string:repository)/businessrules/library :synopsis: List all library business rules in the repository Get a list of all library business rules in the :doc:`repository`. The GET request supports page and pageSize parameters on the URL. If you require a subset of this data (filtering, sorting, or columns), POST to this url with the :doc:`standard request ` body. .. code-block:: http GET /api/repositories/jupiter/businessrules/library 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 data rows 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 library business rules in the :doc:`repository`; this includes :doc:`libraryentitybusinessrule` and Library Attribute business rules. If :ref:`external JSON format ` parameter was set then the details of the library business rules will be returned in a :ref:`JSON key/value pair ` format. Commands -------- .. http:post:: /api/repositories/(string:repository)/businessrules/library :synopsis: List all library business rules in the repository matching certain criteria Get a list of all library business rules in the :doc:`repository` that match various criteria :jsonparam body: The request body .. code-block:: http POST /api/repositories/jupiter/businessrules/library HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "where": "'Actual Threshold' >= 10" } } .. csv-table:: :header: Response Code, Reason :widths: 15, 85 200, Success 400, Invalid request body 400, Invalid command 400, No data received 500, Server error The request requires a :doc:`standard-request` packet. The underlying row data of business rules can be returned in a :ref:`JSON key/value pair ` by setting the :ref:`external JSON format ` parameter for the ``get`` command. 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. Available commands are: .. csv-table:: :header: Command, Description :widths: 15, 85 get, Get all library business rules from the :doc:`repository` that match the criteria in Options list, Returns list of :doc:`libraryentitybusinessrule` belonging to any library entity run, Run analysis for a list of :doc:`libraryentitybusinessrule` belonging to any library entity See the :doc:`librarybusinessrules` for the contents of the request for each command. The response depends on which operation was performed. .. csv-table:: :header: Command, Response :widths: 15, 85 get, A :doc:`standard-response` with a list of the rules matching the given criteria list, Returns list of :doc:`libraryentitybusinessrule` belonging to any library entity run, Returns the URL of the :doc:`job` The response is a :doc:`standard-response`, with a list of all library business rules in the :doc:`repository`; this includes :doc:`libraryentitybusinessrule` and Library Attribute business rules matching the given criteria. If :ref:`external JSON format ` parameter was set then the details of the library business rules will be returned in a :ref:`JSON key/value pair ` format.