API endpoint for returning job status

I have created the following PSU endpoint:

New-PSUEndpoint -Url “/GetJobInfo” -Description “Returns status for a specific job” -Method @(‘GET’) -Endpoint {
#Parameter named jobInfo will be assigned to $jobInfo
#Write-Output “Job id $jobId”
(Get-PSUJob -Id $jobId).Status
} -Environment “Windows PowerShell 5.1”

But when running it with:

Invoke-RestMethod https://FQDN_OF_SERVER/GetJobInfo?jobId=348 -Method GET

I only get a “2” as answer (the job with id 348 completed successfully. When from Powershell running:

(Get-PSuJob -Id “348”).Status

I get “Completed” as expected. So for some reason the API does not return the same string…any ideas are greatly appreciated.

Edit: I adjusted my endpoint to translate the codes per this:

switch ($StatusCode) {
0 { return “Completed” }
1 { return “Running” }
2 { return “Successful” }
default { return “Failed” }

SO I guess that takes care of that, but the follow up to this is if there is a complete list of status codes somewhere?

Product: PowerShell Universal
Version: 4