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

The following procedure uses cURL a command-line tool for running REST API requests.

Procedure

  1. Create a text file with the following CSV format.
    Contract Name,Software Names,Computer Group Name,Seats,Acquisition Cost,
    Maintenance Cost,Entitlement Start,Entitlement End,Maintenance Start,
    Maintenance End,Contract Custom Fields...
    where
    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.
    Example
    Contract 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
  2. Obtain API tokens from both instances of BigFix Inventory.
    1. Hover over the User icon User icon, and click Profile.
    2. In the API Token line, click Show token.
  3. Open the command-line interface and change to the location where cURL is installed.
  4. To import a file with contracts into BigFix Inventory, use the following POST request.
    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
    Where:
    @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.
    Example:
    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.

Results

You successfully imported contracts from a report in CSV format.