cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jfeng523
Community Member

How do I get a User object instead of a UserDisplay object?

Jump to solution

It has been two hours and I still have not figured out yet.

Labels (1)
Tags (1)
1 Solution

Accepted Solutions
James
Community Champion

It is most likely a permissions issue. When I make that call as someone with administrator privileges, I get the full user object.

308359_pastedImage_1.png

If I make the call as a student, I get much of the same information, but without the email or SIS data. That is because our students don't have permissions to read that information.

308393_pastedImage_2.png

View solution in original post

4 Replies
James
Community Champion

 @jfeng523  

You don't provide much information here; about all I can do is make guesses about what you're trying to do. Knowing which API call you're making and what you're trying to accomplish would help us better help you.

My first suggestion would be to use a different API call, you don't say which one you're using, but most calls only return one type and you're not going to be able to get the other without changing calls. In the documentation, the bottom of most API calls end with "Returns a xxx" where xxx is an object type.

The second thing I would do is make sure that you have permissions to view the information. This becomes my first guess if you're making a call that says "Returns a User" but you're not getting a User object.

Also, realize those examples in the documentations are examples and you may not get all of the information or you may get more than what's shown depending on parameters that you pass and permissions you have.

jfeng523
Community Member

I am trying to fetch information about users using their user id. I am requesting these by calling "https://canvas.instructure.com/api/v1/users/self?access_token=[my_token]" which returns a UserDisplay object. UserDisplay contains just enough information to display a user but I need a more detailed one, that is, a User object, which contains more information than UserDisplay object. 

ref Users - Canvas LMS REST API Documentation 

James
Community Champion

It is most likely a permissions issue. When I make that call as someone with administrator privileges, I get the full user object.

308359_pastedImage_1.png

If I make the call as a student, I get much of the same information, but without the email or SIS data. That is because our students don't have permissions to read that information.

308393_pastedImage_2.png

View solution in original post

jfeng523
Community Member

Gotcha. Thank you for your elegant explanation.