createTenant method
Implementation
Future<Map<String, dynamic>?> createTenant({
required String product,
required String username,
required String email,
required String password,
required String first_name,
required String last_name,
required String name,
}) async {
var body = {
"product": product,
"username": username,
"email": email,
"password": password,
"first_name": first_name,
"last_name": last_name,
"name": name,
};
String formData = body.keys
.map((key) =>
"${Uri.encodeComponent(key)}=${Uri.encodeComponent(body[key].toString())}")
.join("&");
final response = await http.post(
Uri.parse('$webbaseUrl/api/ibl/v1/tenant/post/'),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: formData,
);
var data = json.decode(response.body);
return data; // Returns the API response
}