Saved Searches

/api/repositories/{repository}/savedsearches
Parameter Type Purpose
repository string the name of the Repository

Show all saved searches

GET /api/repositories/(string: repository)/savedsearches

Returns a list of all saved searches in a 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 standard request body.

GET /api/repositories/jupiter/savedsearches HTTP/1.1
Accept: application/json
Response Code Reason
200 No error

The response will be a Standard Response.

The columns displayed for each saved search are:

Human Name Column Name Description
ID ID Internal search reference
Name NAME The name for the saved search
Description DESCRIPTION Business Description
Target TARGET Target table name
Target Type TARGETTYPE Target type of the search
Expression EXPRESSION Expression of the search
Created By CREATED_BY User who created the library
Date Created _created_date When the library was created
Edited By EDITED_BY The user who last edited the library
Edited Date _edited_date When the library was last edited

The rows array will contain one element for each saved search:

{
    "dataRow": [
        "1",
        "search1",
        "search description",
        "business_rules",
        "table",
        "<expr><text>'Aggregate First Error'&gt;0</text><gt><var>_aggregate_first_error</var><int>0</int></gt></expr>\ \ \ ",
        "bob",
        "2015/01/02 10:13:19",
        "",
        ""
    ],
    "metadata": {
        "url": "/api/repositories/jupiter/savedsearches/1"
    }
}

Commands

POST /api/repositories/(string: repository)/savedsearches

Allows to post various commands to manage and execute saved searches.

JSON Parameters:
 
  • body – The request body
POST /api/repositories/(string:repository)/savedsearches HTTP/1.1
Content-Type: application/json

{
    "command": "<saved search command>",
    "data": {}
}

The commands that can be performed against saved searches are as follows:

Command Purpose
add Add a new saved search
edit Edit an existing saved search
copy Copy an existing saved search
run Run a saved search / Get a list of saved search expression attributes

The response depends on which operation was performed.

Command Response
add Returns the url of the newly added saved search
edit Returns the url of the updated saved search
copy Returns the url of newly created copy of saved search
run Returns a list of business rules or just the column names. See run command for more information

A post request may return any of the following status codes:

Response Code Reason
200 Success
400 Invalid request body
400 No saved search details given
400 Invalid command
400 No data received
500 Other errors
500 Server error

Add

To add a saved search, the request may contain the fields below:

{
    "command": "add",
    "data": {
        "name": "Test1",
        "description": "List all rule where threshold is equal to 25.",
        "expression": "'Threshold' = \"25\""
    }
}

The required fields for adding a saved search are:

  • name
  • expression

The description field is optional; it is possible to add a saved search without specifying it.

Edit

To edit a saved search, the request may contain the fields below:

{
    "command": "edit",
    "data": {
        "id": "1",
        "name": "Test New Threshold",
        "description": "List all rule where threshold is greater than 25.",
        "expression": "'Threshold' >= \"25\""
    }
}

The required fields for editing a saved search are:

  • id
  • name
  • expression

The description field is optional; it is possible to add a saved search without specifying it.

Copy

To copy a saved search, the request may contain the fields below:

{
    "command": "copy",
    "data": {
        "id": "1"
    }
}

The id field is required for copying an exiting saved search.

Run

The run commands can be performed against saved searches as follows:

Command Data Purpose
run id Run a saved search
run <empty> List saved search column data

The saved searches run command response is a Standard Response with the following columns:

Human Name Column Name Description
Rule Name actual_name Test name.
Entity Name _ename Entity Name.
Attribute Name _aname Attribute name
Library Rule _model Rule exists in libray
Derived Entity _derivedename The associated library entity containing this rule.
Derived Attibute _derivedaname The associated library attribute containing this rule.
Entity ID entity_id Entity ID.
Attribute ID attribute_id Attribute ID.
Rule ID seqno Rule ID.
Priority actual_priority Priority of the rule.
Result _result Result of the test.
Passing Fraction _actual_fraction Percentage of rows that pass the test.
Status _dirty_flag Indicates whether the test is out of date.
Description actual_description Test Description.
Threshold _actual_threshold Compliance Threshold Percentage.
Enabled _check True if the test is enabled.
Priority Description _priority_description Description of the priority
Index Control _index_control Compliance Threshold Percentage.
Index Threshold _index_threshold Compliance Threshold Percentage.
Expression _predicate The Business Rule Test.
Filtering _is_filtering Are the rows being filtered.
Filter Expression _filter_predicate Business Rule Filter.
Filter Error Count _filter_error_count Number of rows that caused an error while running the filter.
Filter First Error Row _filter_first_error_row First row that caused a filter error.
Filter First Error _filter_first_error Error message for first row failing the filter.
Grouping _is_grouping Are the rows being grouped.
Group Count _group_count Number of groups found.
Group Function _group_function Business Rule Group-by function.
Group Error Count _group_error_count Number of rows that caused an error in the group function.
Group First Error Row _group_first_error_row First row that caused a group function error.
Group First Error _group_first_error Error message for first row failing the group function.
Aggregating _is_aggregating Are the rows being aggregated.
Passing Aggregate _aggregate_pass Aggregate value across the passing rows.
Failing Aggregate _aggregate_fail Aggregate value across the failng rows.
Aggregate Method _aggregate_method Method used to aggregate.
Aggregate Function _aggregate_function Business Rule Aggregate function.
Aggregate Error Count _aggregate_error_count Number of rows that caused an error in the aggregate function.
Aggregate First Error Row _aggregate_first_error_row First row that caused an aggregate function error.
Aggregate First Error _aggregate_first_error Error message for first row failing the aggregate function.
Fail Count _row_fail_count Number of Rows that Fail the Test.
Pass Count _row_pass_count Number of Rows that Pass the Test.
Rows Processed _row_total Number of Rows processed.
Row Total row_total Total Number of Rows.
Created By CREATED_BY Who created this business rule.
Created Date _created_date When this business rule was created.
Edited By EDITED_BY Who changed this business rule.
Edited Date _edited_date When this business rule was changed.
Error Count _row_error_count Number of rows that caused an error while running the Test.
First Error Row _first_fail_row First row that caused an error.
First Error _first_error Error message for first failing row.
Referenced Attributes refd_atts A list of the attributes referenced by this rule.
XML actual_predicate Business Rule represented in XML.
Library Rule (boolean) model Is rule located in library
Identifier actual_uuid The rule identifier.
Local identifier _local_identifier A unique identifier for the rule.
Rule Categories _rule_categories Business Rule categories.
Associations _associations Are there any associations for this rule.
NOTE:
  • The Associations column displays number of associations for a Library Entity Business Rule only.
  • Empty Associations column will be displayed for all other business rules.

List Saved Search Columns

To retrieving a list of saved search column names; these column names are required to build humanised expressions for the saved search; the request contain the fields below:

{
    "command": "run"
}

The response is a Standard Response, with an empty rows array.

Delete

DELETE /api/repositories/(string: repository)/savedsearches/(int: savedSearchId)

Delete a specific saved search in a Repository

DELETE /api/repositories/jupiter/savedsearches/1 HTTP/1.1
Accept: application/json
Response Code Reason
200 Success
500 Invalid parameters
500 Server error

If the delete is successful, the response will contain a URL to list all the remaining saved searches.