OSPRIDocs
Developers

PowerShell: make a request

Use PowerShell 7 without installing an SDK.

Set your approved base URL. Keep the token out of shell history:

$env:DIMERIQ_BASE_URL = 'https://dimeriq-staging.ospribrain.com'
$token = Read-Host 'Paste your short-lived access token' -MaskInput
$headers = @{ Authorization = "Bearer $token" }
Invoke-RestMethod -Method Get -Uri "$env:DIMERIQ_BASE_URL/api/science/jobs?panel=true" -Headers $headers -TimeoutSec 30 -MaximumRedirection 0

Read one run by its returned ID:

$runId = 'replace-with-returned-id'
Invoke-RestMethod -Method Get -Uri "$env:DIMERIQ_BASE_URL/api/science/jobs/$runId" -Headers $headers -TimeoutSec 30 -MaximumRedirection 0

To start approved test work, download and review panel.json, then submit it once:

$body = Get-Content './panel.json' -Raw
Invoke-RestMethod -Method Post -Uri "$env:DIMERIQ_BASE_URL/api/science/workflow/discovery/start" -Headers $headers -ContentType 'application/json' -Body $body -TimeoutSec 45 -MaximumRedirection 0

If the request times out, inspect saved runs before repeating it. Remove the token and headers when finished: Remove-Variable token, headers.

The HTTP contract is shared with the other examples. PowerShell-specific execution must be checked in your supported PowerShell environment before adopting it in a release pipeline.