REST API for retrieving the data import status

You use the GET operation on the api/import_status.json element to check the status of data imports in BigFix InventoryLicense Metric Tool.

By using this API, you can check whether an import is currently in progress, what is its percentage status, or when did the last successful import finish. Basing on this information, you can recognize whether data that you can retrieve with other REST API types resembles the actual state of your infrastructure. To do so, ensure that you always retrieve the API data if no imports are currently in progress and the last successful one finished recently.

To retrieve information about the status of a data import, use the following URL:
https://hostname:port/api/import_status.json?token=token
Note: Each API request must be authenticated with the token parameter. You can retrieve it by using REST API for retrieving authentication token. You can also log in to BigFix Inventory, hover over the User icon , and click Profile. Then, click Show token.
Table 1. Operation descriptions

The table consists of two columns and 15 rows. For the eleventh row there are two levels.

Operation details Description
Operation GET /api/import_status.json
Purpose Returns the status of the data import
HTTP method GET
Resource URI https://server_host_name:port_number/api/import_status.json
URL link relation n/a
URI query parameters n/a
Request headers
Header
Accept-Language (optional)
Values
en-US (only English is supported)

Used to negotiate the language of the response. If this header is not specified, the content is returned in the server language.

Request payload n/a
Request Content-Type
  • application/json
Response headers
Header
Content-Type
Values
application/json

Specifies the content type of the response.

Header
Content-Language
Values
en-US, …

Specifies the language of the response content. If this header is not specified, the content is returned in the server language.

Response payload Import status element
Response Content-Type
  • application/json
Normal HTTP response codes
  • 200 – OK
Error HTTP response codes
  • 500 – “Bad Request” if a query parameter contains errors or is missing

Message body includes an error message with details.

Query parameters

You can use query parameters to narrow down the results of your search. The following table presents query parameters that you can use for the api/import_status.json element.
Table 2. Query parameters for retrieving the import status

The table consists of four columns and nine rows.

Parameter Description Required Value
format Specifies the format of the retrieved information. The possible values are json or xml.
Retrieve information in the json format:
URL?format=json
No String
token A unique user authentication identifier. You can view your token in the Profile preferences of BigFix InventoryLicense Metric Tool. Yes Alphanumeric

Example HTTP conversation

Request
GET api/import_status.json
?token=7adc3efb175e2bc0f4484bdd2efca54a8fa04623
Host: localhost:9081 
Accept: application/json 
Accept-Language: en-US
Response header
HTTP/1.1 200 OK
Content-Type: application/json
Content-Language: en-US
Response body (JSON)
If a data import has never been initiated:
{
	"mode": "none",
 	"can_run_imports": true,
	"import_status_url": "/import_status",
	"import_create_url": "/management/imports",
	"progress": 59
 }
If a data import is in progress:
{
	"mode": "running",
 	"can_run_imports": true,
	"import_status_url": "/import_status",
	"import_create_url": "/management/imports",
	"progress": 59
 }
If a data import is not running:
{
  "mode": "idle"/"pending",
  "can_run_imports": true,
  "import_status_url": "/import_status",
  "import_create_url": "/management/imports",
  "last_status": successful,
  "last_success_time": "2014-06-18T04:00:29Z"
}
Where:
  • mode - status of the data import, it can assume the following values:
    • none - a data import has never been initiated
    • idle - no data imports are currently running
    • running - a data import is in progress
    • pending - an action performed in the user interface requires a data import to be started for the change to take effect
  • can_run_imports - specifies whether the user retrieving this API can run imports,
  • import_status_url - web address of this API,
  • import_create_url - web address of the data imports panel in BigFix InventoryLicense Metric Tool,
  • progress - percentage status of the running import,
  • last_status - status of the last import,
  • last_success_time - date of the last successful import.