# Creating a component rule

Availability-note[Beta](https://help.talend.com/r/en-US/Cloud/labels-on-talend-help-center/availability-beta)

Beta content

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
  }
```

![API selected to get all rules.](https://help.qlik.com/Resources/Images/qlik-talend-cloud-migration-toolkit-user-guide/tcmp-api-rules.png)

## 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<br>based on the impact of the rule on the project quality.<br>You can provide one of the following severity types:<br>Info,<br>Minor,<br>Major,<br>Critical. |
   | operator | Specify the comparison operator to compare with the<br>threshold: &lt;=,<br>\&gt;=,<br>=,<br>\&gt;= |
   | value | Enter a value for the threshold. This value sets a<br>limit or boundary, above, or below which a condition<br>should be observed. This field accepts numeric values<br>starting from 0. |
   | type | Enter one of the following threshold types:<br>Percentage or<br>Numeric. |
   | components | Enter the connectors or component names. |
   | parameters | Each component or node in a Job can have parameters<br>such as CODE,<br>URL,<br>URI. For example, tJava<br>component has a CODE parameter.<br><br>Each Job can have parameters<br>(PROJECT\_PARAMETER) such as<br>IMPLICIT\_LOAD or<br>MULTI\_THREAD\_EXECUTION.<br><br>Each connection can have parameters such as<br>PARTITIONER or<br>NUM\_PARTITIONS. |
   | inputs | You can add a list of regular expressions or any text<br>to validate the rule. |
   | exists | Determines if a particular component exists in the<br>Job. The values can be true or<br>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.