Using the Infocyte API to import one or multiple survey files at a time.
Step 1. Create new API token in Infocyte:
Before HTTP requests can be run against the Infocyte Instance, an API token must be generated in the admin section of the Infocyte UI for use with the Infocyte Powershell module.
Click the account icon at the top right hand side of Infocyte, then click Admin.
If logged in as an admin user you will see an option for "Users & Tokens" on the left hand menu of the Admin screen. Click the Users & Tokens button and select the tab “API Tokens”, then click "Create new token" at the top right of the API tokens screen.
If logged in as an analyst user the API tokens screen can be accessed from the "My Profile" screen.
Each API token requires a name before it can be generated, input the desired name for the token then click create. After clicking create, the token will be displayed only once so be sure to copy and store it in a secure location for future use. Once the token has been copied, you can click the close button to close the new API token window.
Step 2. Install the Powershell Infocyte module.
If you haven't already, install the Powershell HUNT Module.
PS > Install-Module InfocyteHUNTAPI
Step 3. Set your HUNT server URL and API token.
PS > Set-ICToken -huntserver https://<cloud instance url> -Token <TOKEN>
A message stating that you Auth token is being set for the specified URL should be displayed.
Step 4. Import the HostSurvey.json.gz
Import a single survey result:
PS > Import-ICSurvey -Path <path to survey.json.gz>
Upload multiple surveys within a folder:
PS> Get-ChildItem <path to survey folder> -filter *.json.gz | Import-ICSurvey
By default, the Import-ICSurvey command will load the survey results into the OfflineScans target group. If you’d like to load the scans into an existing Target Group, provide the TargetGroupId of the target group you want. Get-ICTargetGroup will list these IDs.
The uploaded survey data may take a couple minutes to show up in HUNT, and will be displayed as part of the offline scans target group. Please let us know if you have any questions or issues.