Skip to main content Skip to complementary content

Creating a component rule

Availability-noteBeta

In this scenario, you use Talend APIs to create a component rule to improve your project quality.

About this task

Here are some details about the API call:

Method: POST
endpoint: api/v1/projects/quality/rules/category/components
payload:
    {
    "name": "string",
    "description": "string",
    "severity": "Info",
    "category": "Component",
    "threshold": {
      "operator": "string",
      "value": 0,
      "type": "Percentage"
    },
    "components": [
      "string"
    ],
    "parameters": [
      "string"
    ],
    "inputs": [
      "string"
    ],
    "exists": true
  }

Procedure

  1. Call the POST /api/v1/projects/quality/rules/category/component endpoint to create a rule of the Component categories. There other endpoints available if you want to create a rule of another category.
  2. In the Body area, enter the following information:
    Parameter name Value
    name Enter the name of the rule.
    description Enter the description of the rule.
    severity Enter the severity of the rule. The severity is set based on the impact of the rule on the project quality. You can provide one of the following severity types: Info, Minor, Major, Critical.
    operator Specify the comparison operator to compare with the threshold: <=, \>=, =, \>=
    value Enter a value for the threshold. This value sets a limit or boundary, above or below which a condition should be observed. This field accepts numeric values starting from 0.
    type Enter one of the following threshold types: Percentage or Numeric.
    components Enter the connectors or component names.
    parameters Each component or node in a Job can have parameters such as CODE, URL, URI. For example, tJava component has a CODE parameter.

    Each Job can have parameters (PROJECT_PARAMETER) such as IMPLICIT_LOAD or MULTI_THREAD_EXECUTION.

    Each connection can have parameters such as PARTITIONER or NUM_PARTITIONS.

    inputs You can add a list of regular expressions or any text to validate the rule.
    exists Determines if a particular component exists in the Job. The values can be true or false.

    Example:

     {
        "name": "Java Logs",
        "description": "Identify Jobs that contain java logs",
        "severity": "Info",
        "category": "Component",
        "threshold": {
          "operator": "<=",
          "value": 0,
          "type": "Numeric"
        },
        "components": [
          "tJava", "tJavaFlex", "tJavaRow"
        ],
        "parameters": [
          "CODE", "CODE_START", "CODE_MAIN", "CODE_END"
        ],
        "inputs": [
          "System.out.print", "System.err.print"
        ],
        "exists": true
      }
  3. Click Execute to issue your call.

Results

The rule is created.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!