REST API for data imports
You use the GET operation on the api/import_status.json element to start the import of data or check its status.
Resource URL
To start the import or retrieve information about its status, use the following URL:
https://server_url:server_port/api/import_status.json
Resource information
| Operation details | Description |
|---|---|
| Purpose | Starts the import or returns its status. |
| HTTP method | GET |
| Resource URI | https://server_host_name:port_number/api/import_status.json |
| Request headers |
|
| Request payload | n/a |
Request Content-Type |
|
| Response headers |
|
| Response payload | Import status element |
Response Content-Type |
|
| Normal HTTP response codes |
|
| Error HTTP response codes |
Message body includes an error message with details. |
Available columns
| Column | Description | Displayed by default | Type |
|---|---|---|---|
mode |
Status of the data import. Possible values:
|
✓ | String |
can_run_imports |
Specifies whether the user can run imports. | ✓ | Boolean |
import_status_url |
Web address of this API. | ✓ | String |
import_create_url |
Web address of the data imports panel in License Metric Tool. | ✓ | String |
progress |
Percentage status of the running import. | ✓ | Integer |
last_success_time |
Date and time of the last successful import. | ✓ | String |
last_import_type |
Type of the last import. Possible values:
|
✓ | String |
last_status |
Status of the last import. | ✓ | String |
last_import_time |
Date and time of the last import. | ✓ | String |
next_import_time |
Date and time of the next scheduled import. | ✓ | String |
next_import_time_in |
Time to the next import provided in seconds. | ✓ | Integer |
next_import_type |
Type of the next scheduled import. Possible values:
|
✓ | String |
Query parameters
| Parameter | Description | Required | Value |
|---|---|---|---|
| run | Specifies that the import should be started.
|
No | true |
Example HTTP conversation - starting the import
- Request
-
GET https://server_host_name:port_number/api/import_status.json?run=true - Request header
-
Accept: application/json Accept-Language: en-US Token: <token> - Response header
-
HTTP/1.1 200 OK Content-Type: application/json Content-Language: en-US - Response body (JSON)
- If a data import was successfully started:
{ "mode":"running", "can_run_imports":true, "import_status_url":"/import_status", "import_create_url":"/management/imports", "progress":1, "last_success_time":"2022-08-30T03:09:04Z", "last_status":"successful", "last_import_time":"2022-08-30T03:09:04Z", "last_import_type":"complete", "next_import_time":"2022-08-31T00:00:00Z", "next_import_time_in":38946, "next_import_type":"complete" }
Example HTTP conversation - checking the status of the import
- Request
-
GET https://server_host_name:port_number/api/import_status.json - Request header
-
Accept: application/json Accept-Language: en-US Token: <token> - 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 ... }