Affected Version: BioStar v2.9.6 or above


If you'd like to update one specific user's information, please check out the following link : Update User API.


This article will guide you through a new API supported from v2.9.6 that lets you edit up to 100 users at once. 


Instead of editing one user at a time, if you have several users you'd like to edit at once, this API will be useful.

Note that it will not work for more than 100 users. 



PUT         /api/users/bulk 


Example)


Observe the users' information before calling the API in the below screenshot. 


When you are calling this API, you'll need to construct your body as below screenshot.

"rows" will have a list of users that you want to edit. 

For each element in "rows", "user_id" field is mandatory. It is the id of the user that you want to edit. 

The remaining fields are any of the data that you want to edit for the specific user. 

You can find the specific field names and information from  Update User API


In the below example, I have 3 elements in my "rows". 

First, I'm trying to edit user's name to 'Brad' for user with user Id '6'. 

Second, I'm trying edit user's email to '         @suprema.co.kr' for user with user Id '7'.

Lastly, I'm trying to edit user's user group to '1011'(testing) for user with user Id '8'. 

 


After calling the API, if successful, you'll receive a 200 status code with a response body detailing the results of the change. 


In the response, you'll find the 'ret_code' for each user indicating the result of each edit

It's either going to be "0" (success) or some other error code(ret_code) with a message. 

You can find the meaning of the ret_code from C:\Program Files\BioStar 2(x64)\nginx\html\resources\messages_en.properties file. 


The "code" under "Response" is the overall result of the entire API. 

0 - all edits were successful

1 -partially successful


If all edits failed, you'll receive a 404 status code with response.code "8". 


In the example below, I have successfully edited all three users' information and received a '0' response.code and three '0' ret_code. 


 

As you can see below, user with id '6' name changed from 'carolina' to 'Brad'. 

user with id '7' email address changed to '         @suprema.co.kr'.

user with id '8' user group changed from 'All Users' to 'testing'.