Skip to main content

Get user list

Retrieves all available users into the specified project

 GET /api/1.0/users?project={projectId}

Response

Model: application/json

ARRAY 
[
{
"id": <Integer> the unique id of the user
"email": <String> Temail for the user,
"username": <String> Username for the user,
"status": <Integer> Status id of the user,
"role": <Integer> Role id ,
}
]

Query parameters

Some parameters are allowed for a filtered response

caution

parameters with * are mandatory

* project: <Integer> - Get users for that project id
username: <String> - It will return users containing this username in username
email: <String> - It will return users containing this email in email
role: <Integer> - It will return users for that role id
status: <Integer> - It will return users with that status id //(-2: Disabled, -1: Pending, 0: Bloked, 1: Active)

Example

const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/api/1.0/users?project=22&status=1`, {
mode: "cors",
method: "GET",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
})
if(!serverResponse.ok){
try {
switch (serverResponse.status){
case 400:
j = await serverResponse.json();
break;
case 403:
response = { message: "Forbidden access to data" };
case 404:
response = { message: "Address not found" };
default:
j = await serverResponse.json()
}
} catch (e) {
response = { message: "Error fetching data" };
}
}else{
j = await serverResponse.json()
}

response = { data:j };
const {data, message} = response
if(message) console.debug(message)
if(data) console.debug(data)
}
fetchData()

Answer:

[
{
"id": 1,
"email": "cnp1984@gmail.com",
"username": "carlos",
"status": 1,
"role": 1
},
{
"id": 11,
"email": "beto@gmail.com",
"username": "beto",
"status": 1,
"role": 3
}
]