AnsweredAssumed Answered

Powershell: Post Param

Question asked by Kyle Cole on Mar 14, 2018
Latest reply on Mar 15, 2018 by Kyle Cole

Hello all,

 

I am creating a script to pull the grade export report for a specific term but I am trouble with the term parameter. It is running the report but for every term in our system. Any help would be appreciated! 

 

$urlp = "$domain/api/v1/accounts/$account_id/reports/grade_export_csv"
$headers = @{"Authorization"="Bearer "+$token}
$ContentType = "application/json;"
 

$id = Invoke-WebRequest -Headers $headers -Method Post -Uri $urlp -Body "{'201820_1'}"| ConvertFrom-Json|Select-Object -ExpandProperty ID

Write-Output $id

$urlg = "$domain/api/v1/accounts/$account_id/reports/grade_export_csv/$id"

Start-Sleep 60

$report = Invoke-WebRequest -Headers $headers -Method Get -ContentType $ContentType -Uri $urlg |ConvertFrom-Json|Select-Object -ExpandProperty file_url

Write-Output $report

Invoke-WebRequest -Uri $report -OutFile $output

Outcomes