+package com.braango.virtualdealer.personnel.sms;
+import com.braango.client.ApiCallback;
+import com.braango.client.ApiClient;
+import com.braango.client.ApiException;
+import com.braango.client.braangoapi.SmsApi;
+import com.braango.client.braangomodel.RequestHeader;
+import com.braango.client.braangomodel.SmsInput;
+import com.braango.client.braangomodel.SmsInputBody;
+import com.braango.client.braangomodel.SmsOutput;
+import com.braango.client.braangomodel.SmsOutputBodyDataSmsList;
+ * Sample code showing how to create new SMS number for personnel
+public class CreateSMS {
+ 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
+ SmsApi smsApi = new SmsApi(braangoApiClient);
+ ApiCallback<SmsOutput> callBack = new ApiCallback<SmsOutput>() {
+ public void onUploadProgress(long bytesWritten, long contentLength,
+ .println("Place holder for tracking request progress");
+ public void onSuccess(SmsOutput result, int statusCode,
+ Map<String, List<String>> responseHeaders) {
+ List<SmsOutputBodyDataSmsList> smsList = result.getBody()
+ .getData().getSmsList();
+ System.out.println("SMS LIST : " + smsList);
+ 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,
+ // PersonnelRequestInput wraps RequestHeader and personnelRequestBody
+ SmsInput smsInput = new SmsInput();
+ * { "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("sms-create-s1002r2");
+ smsInput.setHeader(hdr);
+ SmsInputBody body = new SmsInputBody();
+ // Create new SMS number for this personnel
+ body.setSmsNumber("4088723444");
+ smsInput.setBody(body);
+ String subDealerId = "subdealers1002";
+ String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
+ smsApi.createSmsAsync(subDealerId, salesPersonId, smsInput,
+ } catch (ApiException e1) {