How i can retrieve the user id throught username ?

Most of the resources of Bonita API requires the id of user. In order to retrieve the user information , first of all i’m using a mysql query to retrieve the id of user and afterwards i call the API, so , is there a way to retrieve the user information using the username instead of the user id.

i’m using this code , it’s work good, but no is the best way:

  $query = mysqli_query($conexio_bd, "SELECT id from user_ where userName='".$usuari."'");
        while($row=mysqli_fetch_assoc($query)){
        			
         $baseURL = 'http://localhost:8080/bonita/';
        curl_setopt($conexio,CURLOPT_URL,$baseURL.'API/bpm/humanTaskp=0&c=100&f=state%3dready&f=user_id%3d'.**.$row['id']**);


.
.`

Thanks

Simply put No,

the reason user_id is used is the API is written like this, and I suspect basic SQL Normalization techniques come into it somewhere.

The other reason I wouldn’t do this this user_id is anonymous, consider the following

…API/bpm/humanTaskp=0&c=100&f=state%3dready&f=user_id=996

Who is user_id 996? No way of telling.

Whereas

…API/bpm/humanTaskp=0&c=100&f=state%3dready&f=user_name=Jane_Kotton

means anyone scanning the network for data flows will know that Jane Kotton is doing something…What we don’t know but that’s not the point…depending on the business this could be very important…

I think your code is actually not bad.

regards
Seán

PS: If this reply answers your question, please mark a resolved.

Hi,
a simple search on userName will give you the user detail:
API/identity/user?p=0&c=10&o=userName&s=Jane_Kotton

regards,
Richard

Ok, thanks , now i’m trying to optimize my code and i have done simple test in order to know what the way is the bes in order to minimize the delay. Now in some calls to the Api rest , i have put the delay function because i investigated and i have found that the API response is delayed more than php code so is normal?