discordunirest

Discord REST API: get multiple users


I'm trying to query multiple users with a single request by using the Discord REST API with Node.js and the Unirest Module.

unirest.get(`https://discord.com/api/v8/users/{user.id}`).headers({ Authorization: `Bot${botSecret}`})
.then(response =>{
   console.log(response);
})
.catch(error =>{
   console.error(error);
})

In order to get multiple users, I'm passing in the user.id field a list of ids in the following way: "id1,id2,id3"

https://discord.com/api/v8/users/id1,id2,id3

However I get a 'Bad Request' response.

Which is the correct way to query multiple users with a single request??


Solution

  • I had a quick look around the Discord API & discord.js code it seems like they are done individually.

    Discord's API doesn't seem to support getting multiple users at once & discord.js gets an array of users, and iterates through them whilst also checking cache, making sure they dont violate ratelimit, etc.