Closed athornfam2 closed 2 years ago
It doesn't look like the module is installed / imported correctly. It's failing to find private commands which are only loaded when the psm1
file is imported with Import-Module -Name HaloAPI
or if you've downloaded from GitHub (only useful if you're developing the module really) Import-Module /Path/To/HaloAPI/HaloAPI.psm1
I went through the process again to make sure I wasn't missing anything. Other commands are working like Get-HaloTicket -TicketID 399
PS C:\Users\mwolf> Install-Module haloapi
Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): a PS C:\Users\mwolf> Import-Module HaloAPI PS C:\Users\mwolf> Connect-HaloAPI -ClientID "#####" -Tenant "@@@@" -URL "https://###.haloitsm.com" -ClientSecret "####" -Scopes "all" Connected to the Halo API with tenant URL https://###.haloitsm.com:443/ PS C:\Users\mwolf> New-HaloTicket
cmdlet New-HaloTicket at command pipeline position 1
Supply values for the following parameters:
Ticket[0]: Test
Ticket[1]: Temp1234
Ticket[2]:
New-HaloError: C:\Users\mwolf\Documents\PowerShell\Modules\HaloAPI\1.9.0\Public\New\New-HaloTicket.ps1:23
Line |
23 | New-HaloError -ErrorRecord $_
| ~~~~~~~~~
| The Halo API said {"[0]":["Error converting value \"Test\" to type 'HaloClassLibrary.Models.Faults'.
| Path '[0]', line 2, position 8."],"[1]":["Error converting value \"Temp1234\" to type
| 'HaloClassLibrary.Models.Faults'. Path '[1]', line 3, position 12."]}. The API returned the following
| HTTP error response: 400 Bad Request
PS C:\Users\mwolf>
You're passing a string as a ticket object.
A ticket needs to look something like this:
New-HaloTicket -Ticket @{ summary = "Ticket Subject"; tickettype_id = 1 }
There are 20/30 more properties you can (and might want to) set - Get-HaloTicket
will give you the object structure/property names.
What the module is doing is PowerShell saying "you need to have something in the -Ticket
parameter, give me the value." unfortunately for you it's going to keep asking for more values (Ticket[0]
, Ticket[1]
) because the -Ticket
parameter accepts an array of ticket objects which Halo will batch-process.
Thanks @homotechsual that helped. I'll look at the example API documentation Halo to see where I need to add... for example the category_1 when we submit tickets.
I tried to perform the Get-Help on the command but it looked like the -Examples were a little lite. I presume a work in progress? but good work to both of you on this. Saved me a ton of time not reinventing the wheel.
Better documentation is coming - I'm reworking the entire documentation site/layout at the moment and then expanding content.
Contact Details
No response
What happened?
No matter what I enter into New-HaloTicket or New-HaloTicketType it always error's.
Version
1.0.1
Which operating systems have you tested on?
What PowerShell version are you running?
7.2.0-preview.8
Halo Product
Halo ISTM
Halo Version
2.81.18
What command did you run?
What was the output of the command?