Upload installation file to a required software policy.

Upload file to a Required Software policy.

SecuritybearerAuth
Request
path Parameters
id
required
integer

The policy ID for the target policy.

query Parameters
o
integer

The target organization ID. Required for a child organization. Don't use for main organization.

Request Body schema: multipart/form-data
required
file
required
string <binary>
Responses
201

Successful Operation

400

Invalid Request

401

Access token is missing or invalid

403

You do not have permission to perform this action.

429

Too many requests

503

Service Unavailable

default

Invalid Request

post/policies/{id}/files
Request samples
$apiKey = 'your_automox_api_key'
$headers = @{
  "Authorization" = "Bearer $apiKey"
}

$uri = "https://console.automox.com/api/policies/{id}/files?o=9999"
$contentType = "multipart/form-data"
$boundary = [System.Guid]::NewGuid().ToString()

$filePath = "C:\path_to_your_file"
$fileName = Split-Path -Path $filePath -Leaf

$bytes = [System.IO.File]::ReadAllBytes($filePath)
$encodedFile = [System.Text.Encoding]::GetEncoding('UTF-8').GetString($bytes)

$LF = "`r`n"
$bodyLines = (
  "--$boundary",
  "Content-Disposition: form-data; name=`"file`"; filename=`"$fileName`"",
  "Content-Type: application/octet-stream$LF",
   $fileEnc,
  "--$boundary--$LF"
  ) -join $LF

Invoke-WebRequest -Uri $uri -Method Post -ContentType "$contentType; boundary=`"$boundary`"" -Body $bodyLines -Headers $headers
Response samples
application/json
{
  • "errors": [
    • "string"
    ]
}