Samuel
PS I:\> $csv = import-csv -Delimiter "," -Path ‘L:\Teaching and Learning\Learning Resources\eLearning\Canvas\Rollover\1819\RolloverFiles\Mapping2017-18\Final\ShellsMap\Map2017-2018_ManualCourse.csv’
foreach ($line in $csv){
$token = "Token"
$headers =@ {"Authorization"="Bearer "+$token}
$url = "https://institution.beta.instructure.com:443/api/v1/courses/"+ $line.destination_id +"/content_migrations"
$Body = @{"migration_type"="course_copy_importer";"settings[source_course_id]"=$line.source_id}
Invoke-RestMethod -Method Post -Headers $headers -Uri $url -Body $Body
}
Canvas doesn't like the Token it seems even after regenerating it.
At line:7 char:11
+ $headers =@ {"Authorization"="Bearer "+$token}
+ ~
Unrecognized token in source text.
At line:7 char:14
+ $headers =@ {"Authorization"="Bearer "+$token}
+ ~~~~~~~~~~~~~~~
The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept assignments, such as a
variable or a property.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnrecognizedToken
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.