Option for Overwriting or Appending Inventory Notes
Code Insight 2021 R1
The import Web UI and REST interface enable you to specify whether the content of notes fields in an inventory item in the target project should be overwritten with the notes content for an identical inventory item in the import data file. As an alternative to overwriting notes, the notes content for a given inventory item in the import data file can be appended to existing notes content in the identical target inventory. (For a description of identical inventory items, see Identical Inventory.)
This configuration applies to the following inventory notes fields:
• | Notices Text |
• | Audit Notes |
• | Usage Guidance |
• | Remediation Notes |
For more details about this option to overwrite target inventory notes, see the following topics:
• | “Inventory Notes Handling” Option in the Web UI |
• | “overwriteInventoryNotes” Attribute in the REST Interface |
“Inventory Notes Handling” Option in the Web UI
Select the appropriate Inventory Notes Handling option on the Import Project dialog to configure whether the contents of inventory notes fields are overwritten in target inventory during the import. For a description of this option, see Import Project Data Dialog. For complete instructions on using the Web UI to import project data, see Importing Project Data Using the Web UI.
“overwriteInventoryNotes” Attribute in the REST Interface
The option to overwrite target inventory notes is available as the overwriteInventoryNotes attribute in the Import Project Data REST API. The following sections provide attribute details:
• | About the “overwriteInventoryNotes” Attribute |
• | Example “overwriteInventoryNotes” Syntax in the Import cURL Command |
About the “overwriteInventoryNotes” Attribute
To overwrite the content of the notes fields in the target inventory with notes content for identical inventory in the import data file, explicitly include the overwriteInventoryNotes attribute and set it to true in the cURL command that calls the import REST endpoint. Note that, if the data for a given notes field is blank in the import data file, no overwrite occurs; any existing content for the field in the target inventory is retained.
To append notes from the source inventory item to the end of the existing notes in the identical target inventory item, explicitly include the overwriteInventoryNotes attribute and set it to false (or omit the attribute entirely). When content is appended in a given notes field in the target inventory item, it is separated from the existing content with a line break and the following heading:
Copied during import from <ProjectName>:<InventoryName> (TimeStamp)
However, if the note content for a given notes field is the same in both the import data file and the target inventory item, no content is appended in that field in the target inventory item.
Example “overwriteInventoryNotes” Syntax in the Import cURL Command
The following example shows the attribute explicitly included in the cURL command that calls the import REST endpoint:
curl -H "Authorization:Bearer %jwt%" -F importFile=@"FileToImport.zip" -F projectImportModel={ "createEmptyInventory” : true, “overwriteInventoryNotes” : false, “addFilesToInventory” : true, “inventoryFileMatchingCriteria” : “MD5_AND_PARTIAL_FILEPATH”, “inventoryDirectoryDepth” : 2, “markFilesAsReviewed” : true, “reviewFileMatchingCriteria” : “PARTIAL_FILEPATH”, “reviewDirectoryDepth” : 2 };type=application/json http://hostname:8888/codeinsight/api/projects/{projectId}/import
For complete instructions about using the cURL command to execute an import, see Importing Project Data Using the REST API.
For more details about the implementation of the Import Project Data REST API, access the Code Insight Swagger documentation. To do so, click the icon in the upper right corner of the Code Insight Web UI, select Help, and click the REST API Guide link.