Analysis Rule#

An analysis rule will be used to override a default analysis policy. The custom analysis rule may match on customer, submission meta data or classification type/superType. It is not possible to have multiple rules on the same customer, submission meta data or classification type/superType.

Registering a new custom analysis rule#

The role ADMINISTRATOR-ROLE or higher is required to be able to add an analysis rule.

To register a new analysis rule, the analysis rule endpoint can be used with a POST operation. The request and response body is JSON formatted and contains information about the analysis rule. The example request below adds a new analysis rule.

curl -X POST -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" https://api.mnemonic.no/sampledb/v2/policy/default/rule -d '{
  "name": "newRule",
  "description": "New and shiny rule",
  "match": {
    "customer": {
      "customerOrGroup": "1"
  },
    "options": {
      "add": [
        {
          "key": "addKey",
          "value": "addValue"
        }
      ]
    }
  }
}'

For a rule to be valid, it has to comply with the following conditions

  • If the customer match clause is set, the current user must have the read permission for the given customer or group

  • If no customer match clause is set, the current user must have the read permission for any customer

  • If a classification match clause is set, there can only exist one rule per type, superType or type+superType

  • If a submission match clause is set, there can only exist one rule with the given metadata key and value

For more detailed information on what the response model looks like, you can check out the Swagger API documentation.

Updating an analysis rule#

The role ADMINISTRATOR-ROLE or higher is required to be able to update an analysis rule.

To update an analysis rule, the analysis rule endpoint can be used with a PUT operation. The request and response body is JSON formatted and contains information about the analysis rule. The example request below updates an analysis rule.

curl -X PUT -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" https://api.mnemonic.no/sampledb/v2/policy/default/rule/<id> -d '{
  "name": "updatedName",
  "description": "Old and updated, but still a very much shiny rule",
  "match": {
    "submission": {
      "metaDataKey": "newKey",
      "metaDataValue": "newValue"
  },
    "workers": {
      "set": [
        "shortName"
      ]
    }
  }
}'

For more detailed information on what the response model looks like, you can check out the Swagger API documentation.

Deleting an analysis rule#

The role ADMINISTRATOR-ROLE or higher is required to be able to delete an analysis rule.

To delete an analysis rule, the analysis rule endpoint can be used with a DELETE operation. Body is JSON formatted and contains information about the analysis rule. The example request below deletes an analysis rule.

curl -X DELETE -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" https://api.mnemonic.no/sampledb/v2/policy/default/rule/<id>

For more detailed information on what the response model looks like, you can check out the Swagger API documentation.

Fetching analysis rules#

The role ADMINISTRATOR-ROLE or higher is required to be able to fetch or search analysis rules

Fetch a single analysis rule#

To fetch an analysis rule, the analysis rule endpoint can be used with a GET operation. The response body is JSON formatted and contains information about the analysis rule. The example request below fetches an analysis rule.

curl -X GET -H "Argus-API-Key: my/api/key" -H "Content-Type: application/json" https://api.mnemonic.no/sampledb/v2/policy/default/rule/<id>

For more detailed information on what the response model looks like, you can check out the Swagger API documentation.