Skip to main content
Best Answer

Get userid from username

  • December 21, 2023
  • 1 reply
  • 264 views

Hi there

I’m trying to add more infromation to a report for the whole enrolled users to a specific course

the first step was something like this

GET

{url_root}learn/v1/courses/report?page={k}&idCourse={id_course}&page_size= xx

Awesome! I have my usernames list

the response has only these parameters

{"username":"qqq","first_name":"pppp","last_name":"pppp","status":"0","enrollment_date":"2021-11-04 14:57:40","time_in_course":null,"last_access":null,"completion_date":null,"score":"0.00"}

Now the need is add all the custom fileds defined for each username

In the api catalogue I didn’t  find methos with the username in input. All work with userid (this info is missing in the first response) as inquery parameters.

How can I collect the userid strating from username?

Thanks for your help

Best answer by Bfarkas

If you are using the api only for this, I think you’d basically have to use the “get list of users” endpoint and use the search/filters to basically make it a list of 1 user. You’d then have to go get user information for complete info, 3 calls for 1 user. That being said, especially depending on volume you are using for this, I often will use the reports combined with the API for something like this, keep an updated version of the all users report for example with all the additional fields so that you can use it as a lookup table instead of list api and then specific user api. Just a thought. 

View original
Did this post help you find an answer to your question?

1 reply

Bfarkas
Hero III
Forum|alt.badge.img+5
  • Hero III
  • 3582 replies
  • Answer
  • December 21, 2023

If you are using the api only for this, I think you’d basically have to use the “get list of users” endpoint and use the search/filters to basically make it a list of 1 user. You’d then have to go get user information for complete info, 3 calls for 1 user. That being said, especially depending on volume you are using for this, I often will use the reports combined with the API for something like this, keep an updated version of the all users report for example with all the additional fields so that you can use it as a lookup table instead of list api and then specific user api. Just a thought. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings