lpopescu
Level 5

Automation of Custom Rules Creation for FNCI2019.R3

Hello Flexera Support.

We have a very large Auto-WriteUp.xlsx file on FNCI 6.13.2 and we'll like to import it into the Custom Data feature available on FNCI 2019.R3.

Do you have any REST API's examples on how to create new custom detection rules.

Thank you,

LP

 

Labels (1)
0 Kudos
1 Reply
vdonga
Flexera
Flexera

Hello @lpopescu 

We have REST APIs to create, update, delete and get custom detection rules. To try it out, you can head to the REST API guide in the server and try using the Swagger UI

http://<Server_Host>:8888/codeinsight/resources/swagger-ui/index.html

This is the body of the Create Rule API

{
    "componentId": "33065",
    "versionId": "672751",
    "licenseId": "5",
    "description": "Apache Commons",
    "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": "bom.exe",
                      "md5": "638654113CFFCF22A695BD947380848D"
                 }
                ]
}


Here is a sample 'Create Rule' using curl

curl -X POST "http://mymachine:8888/codeinsight/api/rules" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzzzzzzzzzzzzzzzzzzzzzzzzzzzzzQiOjExLCJpYXQiOjE1NzE3LqfYKQzIMiDyZOT6vtJSYBPqknBFCPcykuso_JDEAyLO139LdAKQYOXpM3gjTe05DwZHnUTmKQ" -H "content-type: application/json" -d "{ \"componentId\": \"33065\", \"versionId\": \"672751\", \"licenseId\": \"5\", \"description\": \"Apache Commons\", \"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\": \"bom.exe\", \"md5\": \"638654113CFFCF22A695BD947380848D\" } ]}"

 

Let me know if you have any questions.