createApp method
Future<AppResponse>
createApp({
- required String appId,
- required AppUpsertRequest request,
- String? userAgent,
- String? authorization,
Create an app
Creates an application in an account. You must have application creation rights in the respective account. Main properties and application variables can be set with this API.
Implementation
Future<AppResponse> createApp(
{required String appId,
required AppUpsertRequest request,
String? userAgent, String? authorization
}) async {
Map<String, String> headers = {
"Authorization": authorization ?? appAuthorization,
'Content-Type': 'application/json; charset=UTF-8',
'Accept': 'application/json',
"QB-Realm-Hostname": qBRealmHostname,
"User-Agent": userAgent?? ""
};
Uri endpoint = Uri.https(
baseUrl, "v1/apps");
//print (endpoint.toString());
var response = await
http.post(endpoint, body:jsonEncode(request.toJson()), headers: headers);
if (response.statusCode >= 400) {
throw ApiException(response.statusCode, response.body);
}
else if (response.statusCode == 200) {
return AppResponse.fromJson(jsonDecode(response.body));
}
else {
throw ApiException(response.statusCode, response.body);
}
}