Closed me1299 closed 7 months ago
I just wrote some code without the this wrapper to fetch them. I must say the API is easy to query using Invoke-WebRequest.
$BaseURL = "https://webservices19.autotask.net/ATServicesRest/V1.0"
$ApiIntegrationCode = 'XXX'
$UserName = 'XXX'
$Secret = 'XXX'
$Headers = @{
'ApiIntegrationCode' = $ApiIntegrationCode
'UserName' = $UserName
'Secret' = $Secret
}
$Uri = "$BaseURL/Tickets/entityInformation/fields"
$Picklists = ((Invoke-WebRequest -Uri $Uri -Method "GET" -ContentType 'application/json' -Headers $Headers -UseBasicParsing).Content | ConvertFrom-Json).Fields
#Monitoring Alert ID opzoeken
$IssueId = (($Picklists | Where-Object {$_.Name -Eq "issueType"}).picklistValues | Where-Object {$_.Label -Eq "Monitoring Alert"}).value
#SUBS van Monitoring Alert opzoeken
$SubIssueIds = ($Picklists | Where-Object {$_.Name -Eq "subIssueType"}).picklistValues | Where-Object {$_.parentValue -Eq $IssueId}
Hi @me1299
The New-AutotaskBody
cmdlet can be used to query picklists. For example:
$Body = New-AutotaskBody -Resource Tickets
$Body
This cmdlet is dual purpose in that it also builds an object you can use to create or update existing resources. Unfortunately there seems to be a bug when querying picklist values in the Contracts
entity, for which I'll open a separate issue.
EDIT:
The bug I found has already been opened: https://github.com/KelvinTegelaar/AutotaskAPI/issues/49#issuecomment-1379396895
I'm trying to query EntityInformation fields. I know the API call should be:
/ATServicesRest/V1.0/Tickets/entityInformation/fields
But using
Get-AutotaskAPIResource
I have to use a resource. There is no resourceEntityInformationFields
or anything like that. How do I query this? I cannot find any supporting documentation in the readme.Edit: they are called picklist values.