Skip to content

[Bug]: New-HaloAction with no fields is not working #66

@xasz

Description

@xasz

Contact Details

No response

What happened?

So i have a Halo quick action wich does nothing else than triggering a runbook.

So my payload in the browser is :

[{"ticket_id":"77635","outcome_id":89,"_forcereassign":true,"_includeticketinresponse":true,"timetaken":0.002831111111111111}]

When i strip down the payload i only need ticked_id and outcome_id to get it working via "manual" posting to the endpoint.

This is what i tried:

            $actionTarget = @{
                ticket_id = $($ticketInfo.faultid)
                outcome_id = 87
            }
            
            $result = New-HaloAction -Action $actionTarget -Debug

            # Results in BadRequest 400
            # DEBUG: Query string collection not present...
            # DEBUG: Request body:
            # [
            #   {
            #     "outcome_id": 87,
            #     "_forcereassign": true,
            #     "ticket_id": 77635
            #   }
            # ]
            # DEBUG: Raw ErrorDetails:
            # Line | ... \Modules\HaloAPI\1.22.1\Public\New\New-HaloAction.ps1:23:9
            #   23 |          New-HaloError -ErrorRecord $_
            #      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            #      | Response status code does not indicate success: 400 (Bad Request).

The weird thing is when i use the same payload with the 'Invoke-HaloRequest' method, it works just fine.

 $RequestParams = @{
                Method = 'POST'
                Uri = 'https://' + $myHalo + ':443/api/actions'
                Body = $actionTarget | ConvertTo-Json -AsArray
            }
            
            $response =  Invoke-HaloRequest -WebRequestParams $RequestParams -RawResult

So i use the 'Invoke-HaloRequest' way, which is working for me now, but i dont get why it does not work with New-HaloAction

Version

1.22.1

Which operating systems have you tested on?

  • Windows 10
  • Windows 11
  • Mac OS
  • Linux

What PowerShell version are you running?

Powershell 7.4.3

Halo Product

Halo PSA

Halo Version

2.196.87

What command did you run?

What was the output of the command?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions