Create a data extract

Creates a new data extract.

post
data-extracts

https://console.automox.com/api/data-extracts
Request
Response
Request
Headers
Authentication
required
string
Your Automox API Key for authentication. Format: Authorization: Bearer your_automox_api_key
Query Parameters
o
required
integer
Organization ID for the data extract.
Body Parameters
type
required
string
The data extract that is to be created. Options: patch-history
parameters.start_time
required
string
The start date and time for the extract. Validation: Previous 90 days, starting yesterday.
parameters.end_time
required
string
The end date and time for the extract. Validation: Previous 90 days, starting yesterday and must be after parameters.start_time
Response
200: OK
Data extract successfully created.
{
"id": 156,
"organization_id": 1234,
"user_id": 36700,
"type": "patch-history",
"status": "queued",
"is_completed": false,
"created_at": "2021-05-26T19:55:42.906067+0000",
"download_expires_at": null,
"download_url": null,
"parameters": {
"start_time": "2021-03-28T13:31:57+0000",
"end_time": "2021-03-30T06:42:12+0000"
}
}

Example Requests

cURL
Python http.client
Python requests
C#
PowerShell
cURL
curl --location --request POST 'https://console.automox.com/api/data-extracts?o=1234' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your_automox_api_key' \
"type": "patch-history",
"parameters": {
"start_time": "2021-03-28T13:31:57.510Z",
"end_time": "2021-03-30T06:42:12.117Z"
}
}'
Python http.client
import http.client
import json
conn = http.client.HTTPSConnection("console.automox.com")
payload = json.dumps({
"type": "patch-history",
"parameters": {
"start_time": "2021-03-28T13:31:57.510Z",
"end_time": "2021-03-30T06:42:12.117Z"
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_automox_api_key'
}
conn.request("POST", "/api/data-extracts?o=1234", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Python requests
import requests
import json
url = "https://console.automox.com/api/data-extracts?o=1234"
payload = json.dumps({
"type": "patch-history",
"parameters": {
"start_time": "2021-03-28T13:31:57.510Z",
"end_time": "2021-03-30T06:42:12.117Z"
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_automox_api_key',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
C#
var client = new RestClient("https://console.automox.com/api/data-extracts?o=1234");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer your_automox_api_key");
var body = @"{" + "\n" +
@" ""type"": ""patch-history""," + "\n" +
@" ""parameters"": {" + "\n" +
@" ""start_time"": ""2021-03-28T13:31:57.510Z""," + "\n" +
@" ""end_time"": ""2021-03-30T06:42:12.117Z""" + "\n" +
@" }" + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
PowerShell
$apiKey = 'your_automox_api_key'
$headers = @{ "Authorization" = "Bearer $apiKey" }
$url = "https://console.automox.com/api/data-extracts?o=0000"
$body = @”
{
“type”: “patch-history”,
“parameters”: {
“start-time”: "2021-03-28T13:31:57.510Z",
“end-time”: "2021-03-30T06:42:12.117Z"
}
}
”@
$response = (Invoke-WebRequest -Method Post -Uri $url -Headers $headers -Body $body).Content