fpettigrosso
New Member

API calls to the data Portal help!

Hello all,

I am currently doing a project where I need to extract data from the data dump about teacher transactions and stuff of that nature. I used the code from https://community.canvaslms.com/docs/DOC-5553 and the signature process works for me. For my API call, I am doing it in Powershell. The code is below:

$url_main="https://portal.inshosteddata.com/api/account/self/dump?limit=100&after=45"

$security_token="my secret password"

$header = @{"Authorization"="HMACAuth "+ $security_token }

$purlly=Invoke-WebRequest -Headers $header   -Method Get   -Uri $url_main  

$curlly = ConvertFrom-Json $purlly.Content

when I run the script, I get a 401, unauthorized callback. So my question is there something wrong with my API-call or is there something I am doing wrong?

Labels (1)
0 Kudos
1 Reply
garth
Community Champion

 @fpettigrosso ​ the 401 error suggests to me that Canvas is not accepting your auto token.

Looking at the steps you have above, I don't see where you are hashing the $security_token

It looks like you are passing a plaintext string (you may be hiding the hash for display purposes), are you hashing the secret before you assign it to $security_token?

0 Kudos