API - getting the current user

druge
Recruit

API - getting the current user

Hi- I'm getting started with the Schoology API. I was able to successfully authenticate and fetch course data using 2-legged oauth, and was wondering how I can get the user's ID that the credentials belong to. I was able to get mine by logging into the website and copying it from my profile link, but there's got to be a way to do this from the API, right?

 

Thanks!

Dominic

1 Solution
mbezaire
Practitioner

For development, if you are playing around and already have the user's first and last name, you could use the user search endpoint given a first and last name, and assume the first entry returned is the correct person:

 
There are also other calls which look more appropriate and direct (orange font), which I have not tried:

Other Calls

These other calls are supported, as well. Please read their description for more information.

PathGET https://api.schoology.com/v1/users/me
DescriptionA shortcut for GET users/{user_id} where {user_id} is the user ID of the current API user.
PathGET https://api.schoology.com/v1/app-user-info
DescriptionIf the user has an active Schoology web session, it returns the user id for the passed OAuth tokens and the Schoology web session timestamp. Use this information to validate the given access tokens for the logged in user and to check if the user has an active Schoology web session
 
 

View solution in original post

4 Replies
mbezaire
Practitioner

For development, if you are playing around and already have the user's first and last name, you could use the user search endpoint given a first and last name, and assume the first entry returned is the correct person:

 
There are also other calls which look more appropriate and direct (orange font), which I have not tried:

Other Calls

These other calls are supported, as well. Please read their description for more information.

PathGET https://api.schoology.com/v1/users/me
DescriptionA shortcut for GET users/{user_id} where {user_id} is the user ID of the current API user.
PathGET https://api.schoology.com/v1/app-user-info
DescriptionIf the user has an active Schoology web session, it returns the user id for the passed OAuth tokens and the Schoology web session timestamp. Use this information to validate the given access tokens for the logged in user and to check if the user has an active Schoology web session
 
 
druge
Recruit

/users/me looks like exactly what I'm looking for. not sure why that's burried so deep in the docs. thank you!

JackJ30
Padawan

Hey everyone, I've tried this path but I only receive an empty output. I'm also using two legged auth. Anyone know what might be happening?

Thank you

ParitoshT
Community Support Expert
Community Support Expert

Hi @JackJ30,

 

If the solution shared above did not work for you and if you have already reviewed the Schoology developer's guide then I recommend working with the Schoology support contacts in your school district who should be able to guide you further with this or contact the Schoology team through a support case on your behalf.

 

ParitoshT

Community Moderator