Employee Onboarding API

I need help with finding a specific employee onboarding id based on ticket number (ticket_id) so that I can pull the right fields.

So when a ticket comes through for employee onboarding… it comes through as SR-1234.

Using uri https://domain.freshservice.com/api/v2/onboarding_requests, I get all the Employee Onboarding requests, however, I don’t know how to filter it so that I am pulling only the one for SR-1234.

I’m using powershell. Here is my code so far

$APIKey = 'apikey####'
$EncodedCredentials = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $APIKey,$null)))
$FS_Headers = @{}
$FS_Headers.Add('Authorization', ("Basic {0}" -f $EncodedCredentials))
$FS_Headers.Add('Content-Type', 'application/json')
$FS_base = "https://domain.freshservice.com/api/v2/"

$FS_Ticket= "onboarding_requests"
$FS_URL = $FS_base + $FS_Ticket

$Response = Invoke-RestMethod -Method Get -Uri $FS_URL -Headers $FS_Headers 

$Response.onboarding_requests | fl

Output shows

id : 1
created_at : 2021-05-18T20:41:15Z
updated_at : 2021-05-18T20:41:15Z
status : 3
requester_id : 17001765608
subject : Employee Onboarding Request
fields : @{INFO}

so on and so on with many ids

if you refine the $FS_URL to look like “https://domain.freshservice.com/api/v2/onboarding_requests/<ID #>”, it will show the ticket_id

id : 5
created_at : 2021-05-18T22:18:46Z
updated_at : 2021-05-18T22:18:47Z
status : 3
requester_id : 17000747628
subject : Employee Onboarding Request
ticket_id : 22019
actors : @{Human Resources=}
fields : @{INFO}
lookup_values : @{cf_location=}

is there a way to do a search in that URL like this: “https://domain.freshservice.com/api/v2/onboarding_requests/id?query=ticket_id:22019” --> This doesn’t work, but I meant to look for something that might actually work.

any help will be appreciated!