Find user in Canvas if given their name?

Jump to solution
sam_ofloinn
Community Novice

I'm creating a custom web application for my university that allows users to search for a single user in Canvas.

I've studied the documentation here: https://canvas.instructure.com/doc/api/users.html#method.users.api_index
From what I understand, I can get a single user if I have their ID. "GET /api/v1/users/:id"


However, in building my page, I am thinking of users who may not have the ID of the person they are thinking of: who may only have their name.

I am aware that the base Canvas site has this functionality. How do I use the People page in an account?  However, I am creating a custom page, that is its own application yet uses Canvas endpoints to use its data. Hence I need this new app to have this functionality.


I imagine I can search my entire directory of users until I find one with a matching name, but I also fear that'd have an incredibly heavy load.

Is there any other method I can use to find just one user?

Labels (3)
1 Solution
bneporadny
Community Champion

Hi Lee,

I think you're on the right track with using the users api‌, but you may have over looked a functionality. Using the users api‌ you can actually search for users using the search_term‌ parameter‌. 

Users - Canvas LMS REST API Documentation 

331416_pastedImage_3.png

Hope this helps and is what you're looking for.

View solution in original post