+package com.braango.virtualdealer.group;
+import com.braango.client.ApiCallback;
+import com.braango.client.ApiClient;
+import com.braango.client.ApiException;
+import com.braango.client.braangoapi.EmailsApi;
+import com.braango.client.braangoapi.GroupsApi;
+import com.braango.client.braangomodel.EmailOutputBodyData;
+import com.braango.client.braangomodel.GroupInput;
+import com.braango.client.braangomodel.GroupInputBody;
+import com.braango.client.braangomodel.GroupOutput;
+import com.braango.client.braangomodel.GroupOutputBodyData;
+import com.braango.client.braangomodel.RequestHeader;
+import com.braango.client.braangomodel.EmailInput;
+import com.braango.client.braangomodel.EmailInputBody;
+import com.braango.client.braangomodel.EmailOutput;
+ * Sample code showing how to create group for personnel
+public class CreateGroup {
+ static String basePath = "https://testapi2.braango.com/v2/braango";
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ ApiClient braangoApiClient = new ApiClient();
+ // TEST auth token. Please contact
+ // sales@braango.com to have one
+ String authToken = "ISNWF0P30WM0CMK";
+ braangoApiClient.setBasePath(basePath);
+ // Set the auth_token for api client to
+ // interact with Braango system
+ braangoApiClient.setApiKey(authToken);
+ // Api key is authorization to to access
+ // resources within braango system
+ // This key is different than auth_token
+ // that is used to validate the master account
+ String apiKey = "ISNfTMNOumV3xYNDd2g";
+ // Create personnel api. Personnel is hosted by subDealer
+ GroupsApi groupApi = new GroupsApi(braangoApiClient);
+ final Boolean typeAdfCrmEmail = false;
+ ApiCallback<GroupOutput> callBack = new ApiCallback<GroupOutput>() {
+ public void onUploadProgress(long bytesWritten,
+ .println("Place holder for tracking"
+ + " request progress");
+ public void onSuccess(GroupOutput result, int statusCode,
+ Map<String, List<String>> responseHeaders) {
+ GroupOutputBodyData groupList = result.getBody()
+ System.out.println("Group List : " + groupList);
+ public void onFailure(ApiException e, int statusCode,
+ Map<String, List<String>> responseHeaders) {
+ System.out.println("Error is " + statusCode + " "
+ + e.getResponseBody());
+ public void onDownloadProgress(long bytesRead, long contentLength,
+ // GroupRequestInput wraps RequestHeader and GroupRequestBody
+ GroupInput groupInput = new GroupInput();
+ * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
+ * "account_type": "partner" }
+ RequestHeader hdr = new RequestHeader();
+ // Set the account type to partner for
+ // virtual dealer and partner hosted
+ hdr.setAccountType("partner");
+ // dealer_api_key returned
+ // when partner_dealer was created
+ // ID that will be reflected back
+ hdr.setId("group-create-s1002r1");
+ groupInput.setHeader(hdr);
+ GroupInputBody body = new GroupInputBody();
+ body.setGroup("test grp");
+ groupInput.setBody(body);
+ String subDealerId = "subdealers1002";
+ String salesPersonId = "b6520174-f4de-4ae6-b3e9-7f74174cb2d2";
+ groupApi.createGroupAsync(subDealerId, salesPersonId, groupInput, callBack);
+ } catch (ApiException e1) {