Returns every step in a job's current version. Get a Job already embeds this same list -- use this call instead when you only care about the steps and don't need the rest of the job's detail.
Having trouble reaching the API, or logging in from another machine? See Network Access & Authentication Security -- by default the Api only answers
localhost, and PowerShell needs an extra flag once it does answer elsewhere.
Order of Operations
- Authenticate to the API.
- Get the job's current version id.
- Request its steps.
The call
GET /api/job-versions/{jobVersionId}/steps
Permission needed: Job.View on the job this version belongs to.
C# example
var jsonOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web);
// Step 1: Authenticate to the API.
using var handler = new HttpClientHandler { UseDefaultCredentials = true };
using var client = new HttpClient(handler) { BaseAddress = new Uri("http://your-minion-agent-server:5443") };
client.DefaultRequestHeaders.Add("X-App-Name", "MyIntegration");
// Step 2: Get the job's current version id.
var jobName = Uri.EscapeDataString("Nightly ETL Load");
var jobRef = await (await client.GetAsync($"/api/jobs/by-name/{jobName}")).Content.ReadFromJsonAsync<JobRef>(jsonOptions);
var job = await client.GetFromJsonAsync<JobVersionRef>($"/api/jobs/{jobRef!.JobID}", jsonOptions);
// Step 3: Request its steps. Only declaring the fields we care about --
// extra JSON properties on the real (much larger) step shape are ignored.
var steps = await client.GetFromJsonAsync<StepSummary[]>($"/api/job-versions/{job!.JobVersionID}/steps", jsonOptions);
foreach (var step in steps!)
{
Console.WriteLine($"{step.JobStepID}: {step.StepName}");
}
record JobRef(int JobID);
record JobVersionRef(int JobVersionID);
record StepSummary(int JobStepID, string StepName, byte StepTypeCode);
Not on a domain machine? Swap in the app-account login from Calling the API From Your Own Code.
PowerShell example
# Step 1: Authenticate to the API.
$headers = @{ "X-App-Name" = "MyIntegration" }
# Step 2: Get the job's current version id. (-AllowUnencryptedAuthentication: PowerShell requires this for Windows auth over plain http to anything but localhost -- see "Network Access & Authentication Security".)
$jobName = [Uri]::EscapeDataString("Nightly ETL Load")
$jobRef = Invoke-RestMethod -Uri "http://your-minion-agent-server:5443/api/jobs/by-name/$jobName" -UseDefaultCredentials -AllowUnencryptedAuthentication -Headers $headers
$job = Invoke-RestMethod -Uri "http://your-minion-agent-server:5443/api/jobs/$($jobRef.jobID)" -UseDefaultCredentials -AllowUnencryptedAuthentication -Headers $headers
# Step 3: Request its steps.
$steps = Invoke-RestMethod -Uri "http://your-minion-agent-server:5443/api/job-versions/$($job.jobVersionID)/steps" -UseDefaultCredentials -AllowUnencryptedAuthentication -Headers $headers
$steps | ForEach-Object { "$($_.jobStepID): $($_.stepName)" }
What you get back
200 OK -- an array, one entry per step. Each carries a large real shape (command text, credential, target server, canvas position, pool/gate/delay settings, and more); a trimmed look:
[
{ "jobStepID": 100, "stepKey": "...", "stepName": "Stage table 1", "stepTypeCode": 0, "commandTextStatus": "ok", "commandText": "...", "credentialId": null, "targetServerId": null, "...": "..." }
]
commandTextStatus tells you whether commandText is actually usable: "ok" (you have permission and it decrypted fine), "empty", "HIDDEN_INSUFFICIENT_PERMISSION" (you lack Job.ViewCode for this step), or "DECRYPTION_FAILED_POSSIBLE_TAMPERING".
Codes this call can return
See API Response Codes for what each one means in general. For this specific call:
- 200 -- the list, even if it's empty (or the version doesn't exist -- this call doesn't 404 on a dead
jobVersionId). - 403 -- you don't have
Job.Viewon the job.
See also: Get a Job, Create a Job Step, Update a Step.