Options for Handling Inventory Usage Values

The import Web UI and REST interface enable you to specify whether the import process should copy the current inventory Usage values to the target project or reset all values for imported inventory to the system default value, Unknown. For details, see the following topics:

“Inventory Usage Handling” Options in the Web UI
“resetInventoryUsage” Attribute in the REST Interface

The default import behavior is to reset Usage values for imported inventory to the default value, Unknown.

“Inventory Usage Handling” Options in the Web UI

Select the appropriate Inventory Usage Handling option (Reset usage field values to system default or Copy existing usage field values) on the Import Project dialog to configure how inventory usage values should be handled. For a description of these two options, 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. The default is to reset all values to the default Unknown.

“resetInventoryUsage” Attribute in the REST Interface

The attribute resetInventoryUsage in the Import Project Data REST API is used to determine how the import process should handle Usage values for imported inventory. The following sections provide attribute details:

About the “resetInventoryUsage” Attribute
Example “resetInventoryUsage” Syntax in the Import cURL Command

About the “resetInventoryUsage” Attribute

If you set the resetInventoryUsage attribute to true (or omit the attribute entirely) in the cURL command that calls the import REST endpoint, the import process resets all Usage values for imported inventory to the system default value, Unknown. (This is the default behavior.)

Conversely, to configure the import process to copy existing Usage values to the imported inventory, you must explicitly include the resetInventoryUsage attribute in the cURL command and set it to false.

Example “resetInventoryUsage” 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, "resetInventoryUsage": false" };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.