Force canada
This commit is contained in:
@@ -1,21 +1,30 @@
|
||||
function Invoke-AutotaskProvision {
|
||||
param (
|
||||
[Parameter(Mandatory)][string]$CompanyName,
|
||||
[Parameter(Mandatory)][string]$PhoneNumber,
|
||||
[Parameter(Mandatory)]
|
||||
[string]$CompanyName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]$PhoneNumber,
|
||||
|
||||
[string]$Website,
|
||||
[string]$Street,
|
||||
[string]$City,
|
||||
[string]$Province,
|
||||
[string]$PostalCode,
|
||||
[string]$Country,
|
||||
[Parameter(Mandatory)][hashtable]$Credentials
|
||||
[string]$Country, # Not used but accepted for compatibility
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$Credentials
|
||||
)
|
||||
|
||||
if (-not $Credentials["AutotaskURL"] -or -not $Credentials["AutotaskIntCode"] -or -not $Credentials["AutotaskUsername"] -or -not $Credentials["AutotaskSecret"]) {
|
||||
if (-not $Credentials["AutotaskURL"] -or
|
||||
-not $Credentials["AutotaskIntCode"] -or
|
||||
-not $Credentials["AutotaskUsername"] -or
|
||||
-not $Credentials["AutotaskSecret"]) {
|
||||
throw "Missing Autotask credentials in hashtable."
|
||||
}
|
||||
|
||||
$Url = "https://$($Credentials["AutotaskURL"])/atservicesrest/v1.0/companies"
|
||||
$BaseUrl = "https://$($Credentials["AutotaskURL"])/atservicesrest/v1.0/companies"
|
||||
|
||||
$Headers = @{
|
||||
"ApiIntegrationcode" = $Credentials["AutotaskIntCode"]
|
||||
@@ -38,7 +47,7 @@ function Invoke-AutotaskProvision {
|
||||
} | ConvertTo-Json -Depth 3
|
||||
|
||||
try {
|
||||
$Response = Invoke-RestMethod -Uri $Url -Method Post -Headers $Headers -Body $Body
|
||||
$Response = Invoke-RestMethod -Uri $BaseUrl -Method Post -Headers $Headers -Body $Body
|
||||
return $Response.itemId, $Response.id, $Response.companyID, $Response.item.id | Where-Object { $_ } | Select-Object -First 1
|
||||
} catch {
|
||||
throw "[Autotask] Provisioning failed: $($_.Exception.Message)"
|
||||
|
||||
Reference in New Issue
Block a user