Skip to content

Create Rule

Request

Add new rule with either file info or rule info.

Note: Value for detectionCriteria is an array of string Eg. detectionCriteria: ["filepath1 or folderpath1","filepath2 or folderpath2"].

Parameters fileInfo and ruleInfo are mutually exclusive. Only users with Library Manager role can create rules.

Security
bearerAuth
Bodyapplication/jsonrequired

Add new rule.

inventoryNamestring

inventoryName

Example:"Custom Inventory Name"
componentIdinteger, (int64), >= 1required

componentId

Example:1
versionIdinteger, (int64), >= 1required

versionId

Example:1
licenseIdinteger, (int64)required

licenseId

Example:1
licenseExpressionstring

License expression string

Example:"7 OR 20"
licenseIdsArray of integers

List of license IDs in the expression

Example:
[ 7, 20 ]
descriptionstring

description

Example:"description"
urlstring, [ 0 .. 2400 ] characters(NA|^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=...

url

Example:"https://www.flexera.com/"
noticesTextstring

noticesText

Example:"Sample Notices Text"
auditNotesstring

auditNotes

Example:"Sample Audit Notes"
asFoundLicenseTextstring

asFoundLicenseText

Example:"Sample from file LICENSE.txt in file @file in the materials"
fileInfoArray of objects(FileInfo)

fileInfo

ruleInfoArray of objects(RuleInfo)

ruleInfo

curl -i -X POST \
  https://codeinsightapi.redocly.app/_mock/swagger/rules \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "inventoryName": "Custom Inventory Name",
    "componentId": 1,
    "versionId": 1,
    "licenseId": 1,
    "licenseExpression": "7 OR 20",
    "licenseIds": [
      7,
      20
    ],
    "description": "description",
    "url": "https://www.flexera.com/",
    "noticesText": "Sample Notices Text",
    "auditNotes": "Sample Audit Notes",
    "asFoundLicenseText": "Sample from file LICENSE.txt in file @file in the materials",
    "fileInfo": [
      {
        "name": "fileName",
        "md5": "md5"
      }
    ],
    "ruleInfo": [
      {
        "detectionType": "filePath",
        "detectionCriteria": "[filepath]"
      }
    ]
  }'

Responses

Created