AnsweredAssumed Answered

Reduce number of requests

Question asked by mr0053731 on Oct 15, 2018
Latest reply on Oct 22, 2018 by mr0053731

I am trying to optimize a script that updates enrollment for a specific user in a specific course. currently I am making 4 requests to complete the process.

1. call to obtain the token

2. using the REST API I am able to look up (get) the course PK1 (ID) using the course_id seen in the GUI.

GET /learn/api/public/v1/courses?courseId={course_id}

3. then i lookup the users id (PK1) with the following:

GET /learn/api/public/v1/users?externalId={user_id}


I parse the information gathered above to produce the following:

4. PATCH /learn/api/public/v1/courses/{course_id}/users/{user_id}


this works well, but if I have to do this for thousands of users I will hit the 10K limit quick.


do you know if it is possible to send the PATCH request above using the courseid and username found in the GUI, rather than looking up their PK values first?

this is what I had in mind:PATCH /learn/api/public/v1/courses/{course_id}/users/{user_id}?courseId={course_id}&externalId={user_id}


maybe a SIS integration would suit my needs better?