Your Community is getting an upgrade!
Read about our partnership with Higher Logic and how we will build the next generation of the Instructure Community.
Hello! I need to export a list of all users that includes their last_login attribute, and hopefully find a way to reset the password or any user that hasn't logged in for a set period of time - say 180 days.
I can pull the first 10 users with the call below but can't seem to get it to the next page of results. Every variation I have tried so far gives me the error "{"status: unauthenticated","errors":[{"message":"user authorization required"}]}" - even though I'm passing my token and authenticate successfully for the first page or results. Has anyone run into this, or can you tell me what I'm doing wrong? I'm new to Canvas and the API so don't have much experience yet.
My command:
curl https://myuniversity.instructure.com/api/v1/accounts/1/users?include[]=last_login -G -H 'Authorization: Bearer This-Is-My-Super-Secret-Token'
Command I'm trying to get the next page of results that fails:
curl https://myuniversity.instructure.com/api/v1/accounts/1/users?include[]=last_login&page=2&per_page=10 \ -G -H 'Authorization: Bearer This-Is-My-Super-Secret-Token'
Solved! Go to Solution.
I don't see anything wrong with your command. You can specify results with the `per_page` param on your initial request that will carry forward with the `<Link>` header param you get back (get 100 at a time, for example).
Are you using an API client like Postman? Or using the terminal directly? Is there any way for you to inspect the response headers?
Also, if you're comfortable using Python, there is a fantastic open library for the Canvas API that makes work like this much easier.
I don't see anything wrong with your command. You can specify results with the `per_page` param on your initial request that will carry forward with the `<Link>` header param you get back (get 100 at a time, for example).
Are you using an API client like Postman? Or using the terminal directly? Is there any way for you to inspect the response headers?
Also, if you're comfortable using Python, there is a fantastic open library for the Canvas API that makes work like this much easier.
Thanks for the reply! I am doing it directly in the terminal and found that I have to enclose the URL in quotes " " for it to go through. I will definitely check out the Python wrapper. Thanks again!!
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign InTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign In
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.