0

I'm trying to add 10.000 users via the Moodle API in one time, but the generated URI is too long. How can I fix this problem?

I know the URI is way too long, 1.750.000 characters, but I have no idea if there is an other way to do this?

Thanks in advance!!

EDIT

Fixed my problem by 'splicing' the array in an array of arrays. I spliced it by 25, so 25 users are added at a time. 500 was still to many. Didn't find the exact maximum length of the URI, but this works. Adding 10.000 users in one batch takes around 8.5 minutes. If anyone knows a better and faster way, always welcome!

Thanks

Milan_w
  • 291
  • 2
  • 4
  • 17

1 Answers1

0

Consider sending the request in batches of 500, perhaps?

If you are worried about sending duplicates you could mark users successfully added to the API as "sent" in your local database/setup and only send "unsent" users to the Moodle API.

crmpicco
  • 16,605
  • 26
  • 134
  • 210
  • Do you know how to do this correctly in Angular2? Sending them in batch? And how does that work, marking users as 'sent'? – Milan_w Apr 12 '17 at 10:01