createGroup method
Future<CreateGroupResponseDto>
createGroup(
- String apiKey, {
- required CreateGroupRequestDto createGroupRequestDto,
Implementation
Future<CreateGroupResponseDto> createGroup(
String apiKey, {
required CreateGroupRequestDto createGroupRequestDto,
}) async {
final String url = '$channel/api/v1/mdm/apps';
final requestDto = createGroupRequestDto.toJson();
requestDto.removeWhere((key, value) => value == null);
final response = await http.post(
Uri.parse(url),
headers: {
'Authorization': 'Zoho-oauthtoken $apiKey',
'Content-Type': 'application/json;charset=UTF-8',
},
body: requestDto.isEmpty ? null : jsonEncode(requestDto),
);
if (!response.statusCode.isSuccessful) {
throw MdmEngineException(
method: response.request?.method,
url: url,
statusCode: response.statusCode,
error: response.body,
);
}
return CreateGroupResponseDto.fromJson(
jsonDecode(
response.body,
),
);
}