Skip to main content

Get All Users

Get Users List Example

To retrieve a paginated list of all users created under your partner account, use the getUsers method.

Usage Example:

import 'package:altibbi/service/api_service.dart';

ApiService apiService = ApiService();

void fetchUsers() async {
try {
List<User> users = await apiService.getUsers(page: 1, perPage: 20);
print(\"Retrieved ${users.length} users\");
} catch (e) {
print(\"Error: $e\");
}
}

Response Structure

Returns a List<User> object.

Status 200

Success

[
{
"id": '999999999',
"name": "Altibbi User",
"email": "[email protected]",
"date_of_birth": "2000-01-30",
"createdAt": "2024-01-30",
"updatedAt": "2024-01-30",
"gender": "male",
"insurance_id": "123123123",
"policy_number": "111111111",
"height": 180,
"weight": 90,
"blood_type": "A+",
"smoker": "yes",
"alcoholic": "no",
"marital_status": "single"
}
]

Status 401

UnauthorizedHttpException represents an Unauthorized HTTP exception with status code 401.

{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials",
"code": "0",
"status": "401",
"type": "yii\\\\web\\\\UnauthorizedHttpException"
}