Curl - Check Job Status
When you submit a curl job you should get a response back from the StreamEngine server with the job id on it.
Curl - Linux and Windows
curl -u API_KEY:a -H "Content-Type: application/json" https://streamengine.igolgi.com/api/v0/job/<JOB_ID>
replace API_KEY with your StreamEngine API Key
replace <JOB_ID>
If you only want to see job status and have jq installed on linux you can run
curl -u API_KEY:a -H "Content-Type: application/json" https://streamengine.igolgi.com/api/v0/job/<JOB_ID> | jq ".status"
$ curl -u API_KEY:a -H "Content-Type: application/json" https://streamengine.igolgi.com/api/v0/job/<JOB_ID> | jq ".status"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1079 100 1079 0 0 9989 0 --:--:-- --:--:-- --:--:-- 10084
{
"job_id": "5087",
"tcode_progress": "100",
"state": "ready",
"tcode_time": "36.84",
"tcode_speed": "0.0",
"job_completed": true,
"xfer_speed": "0.0",
"xfer_time": "86398.93",
"xfer_progress": "100"
}
Note the job_id above (backend) will be different than is the <JOB_ID> submitted which is the id of the frontend,
or
$ curl -u API_KEY:a -H "Content-Type: application/json" https://streamengine.igolgi.com/api/v0/job/<JOB_ID> | jq ".status.job_completed"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1079 100 1079 0 0 9099 0 --:--:-- --:--:-- --:--:-- 9144
true
jq is available for Windows, use at your own risk, it's a separate install, AMD64 executable should work with intel.
windows cmd
On Windows with PowerShell. PowerShell is a little different curl works but -u option does not so we will need to write a program.
$jobId = "<JOB_ID>" # Replace with your actual job ID
$url = "https://streamengine.igolgi.com/api/v0/job/$jobId"
$username = "API_KEY"
$password = "a"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$headers = @{
Authorization = "Basic $base64AuthInfo"
"Content-Type" = "application/json"
}
$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
# Output the entire status object
$response.status | ConvertTo-Json
# Or, to get specific fields:
# Write-Output "State: $($response.status.state)"
# Write-Output "Job Completed: $($response.status.job_completed)"
save it to a file for example CheckJobStatus.ps1
Then you can run the script above.
.\CheckJobStatus.ps1 -JobID <JOB_ID>
Linux shell script if you want to store your API key an reuse it with a script.
#!/bin/bash
JOB_ID=$1
if [ -z "$JOB_ID" ]; then
echo "Please provide a job ID as an argument."
echo "Usage: ./check_job_status.sh <job_id>"
exit 1
fi
echo "Checking status for job ID: $JOB_ID"
while true; do
response=$(curl -s -u API_KEY:a -H "Content-Type: application/json" https://streamengine.igolgi.com/api/v0/job/$JOB_ID)
status=$(echo $response | jq -r '.status')
echo "Job status: $status"
if [ "$status" = "completed" ]; then
echo "Job completed!"
break
else
echo "Job still in progress. Waiting 10 seconds before checking again..."
sleep 10
fi
done
Curl - Windows PowerShell
On Windows in powershell
.\CheckJobStatus.ps1 -JobId <Your-Job-ID>
param(
[Parameter(Mandatory=$true)]
[string]$JobId
)
$url = "https://streamengine.igolgi.com/api/v0/job/$JobId"
$username = "API_KEY"
$password = "a"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$headers = @{
Authorization = "Basic $base64AuthInfo"
"Content-Type" = "application/json"
}
function Check-JobStatus {
try {
$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get
return $response
}
catch {
Write-Host "Error checking job status: $_"
return $null
}
}
Write-Host "Checking status for job ID: $JobId"
do {
$result = Check-JobStatus
if ($result -ne $null) {
$status = $result.status # Adjust this if the API response structure is different
Write-Host "Job status: $status"
if ($status -ne "completed") {
Write-Host "Job still in progress. Waiting 10 seconds before checking again..."
Start-Sleep -Seconds 10
}
}
else {
Write-Host "Failed to get job status. Retrying in 10 seconds..."
Start-Sleep -Seconds 10
}
} while ($status -ne "completed")
Write-Host "Job completed!"