Importing contracts from a file in CSV format
You can use the cURL command-line tool to issue a POST request to import a csv file with contracts.
About this task
Procedure
- Create a text file with the following CSV format.
whereContract Name,Software Names,Computer Group Name,Seats,Acquisition Cost, Maintenance Cost,Entitlement Start,Entitlement End,Maintenance Start, Maintenance End,Contract Custom Fields...
- Contract Name
- The name of the contract. It must be unique. If the contract with a given name exists in BigFix Inventory, the importing of that row with contract definition is skipped.
- Software Names
- Names of software products, versions or/and releases that are separated by a comma.
- Computer Group Name
- Name of the computer group. The computer group with given name must exist in BigFix Inventory. Otherwise, the import of that row fails.
- Seats
- Number of users who have access to the software product under a particular contract. In case of an ELA license, the column must be empty. (optional)
- Acquisition Cost
- The cost of purchasing a software product.
- Maintenance Cost
- The cost of purchasing maintenance plan for a software product.
- Entitlement Start
- The start date for a particular contract.
- Entitlement End
- The end date for a particular contract. (optional)
- Maintenance Start
- The maintenance plan start date for the software products. (optional)
- Maintenance End
- The maintenance plan end date for the software products. (optional)
- Contract Custom Fields
- The list of contract custom fields values separated by a comma. All custom fields must exist in BigFix Inventory. Otherwise, the import of that row fails. Moreover, all custom fields that are required in BigFix Inventory must be listed in the file.
ExampleContract Name,Software Names,Computer Group Name,Seats,Acquisition Cost, Maintenance Cost,Entitlement Start,Entitlement End,Maintenance Start, Maintenance End,custom integer,custom boolean Name1,"BigFix Software Assembly Toolkit,License Metric Tool 7, License Metric Tool 9.0",All Computers,10,10.0,5.0,2015-04-24, 2015-05-31,2015-04-24,2015-05-31,1,true Name2,BigFix Inventory,All Computers,0,1.0,2.0,2015-04-24,,,,,false
-
Obtain API tokens from both instances of BigFix Inventory.
- Hover over the User icon , and click Profile.
- In the API Token line, click Show token.
- Open the command-line interface and change to the location where cURL is installed.
- To import a file with contracts into BigFix Inventory,
use the following POST request.
Where:curl -H "Content-Type: multipart/form-data" -X POST -F "upload[contracts]=@path_to_file" http://server_host_name:port_number/ api/sam/contracts/import?token=token
- @path_to_file
- Specifies the path to the file where the definition of contracts was saved.
- server_host_name
- Address of the BigFix Inventory server.
- port_number
- The communications port number.
- token
- API token from profile view.
curl -H "Content-Type: multipart/form-data" -X POST -F "upload[contracts]=@C:\temp\contracts.csv" http://localhost:9081/ api/sam/contracts/import?token=a2279dc218ecd1f12a5e2fc1b5d77a4e6fec6593
If the request is successful, a response in JSON format is displayed.