Personnel are entities that can interact with customers.

Based on certain privileges personnel ability to act as managers.

Personnels API encapsulates creating of manager level personnel or regular personnel via seperate end points and thus simplifying the process

Following are the operations supported by this API

  • Get Personnel for given sub_dealer
  • Get Personnel for given virtual dealer
  • Create virtual dealer
  • Create sub dealer
  • Create regular personnel
  • Update personnel
  • Delete personnel details

Creating personnel along with braango_number is all that is needed to get braango product functionality going as it is free running product

(Note to create regular personnel, sub_dealer personnel needs to be present)

Use this call to create a partner dealer account into the braango system. Typically this could be a real dealership or it could be virtual dealer created by channel partner. The partner dealer account can hold more than 1 sub dealers based on package selected.

sub dealers are entities that have privileges to add personnel, create supervisors, create groups etc.

In virual dealer mode, typically sub dealer will be actual business the partner is registering with the braango system.

In real dealer mode, sub dealer could be a location

Note sub dealer are actually personnel with full privileges. Typically businesses can use general manager personnel for sub dealer details

Typically based on channel partner’s business model, either channel partner can create a virtual dealer and have all of his clients as sub dealers. This allows for single dashboad managent for partner’s all dealers. Further more, this model allows tighter control over some global resources that channel partner may want to employ. To use this model, please select package “Enterprise”. Currently for each virtual dealer, there can be 3000 sub dealers created.

Virtual dealer model is highly recommended for braango leads product. Further more virutal dealer model allows for flat hierarchy –> Virtual Dealer->Sub Dealer->Personnel.

For virtual dealer model, each franhcise location will be created as separate sub-dealer

For real dealer model i.e channel partner creating a real dealer account is good for scenarios where franchise dealers want their own hierarchy and single dashboard.

/**
 * 
 */
package com.braango.virtualdealer;

import java.util.UUID;

import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.AccountsApi;
import com.braango.client.braangomodel.AccountCreateOutputWrapper;
import com.braango.client.braangomodel.AccountCreateOutputWrapperBody;
import com.braango.client.braangomodel.AccountCreateOutputWrapperBodyData;
import com.braango.client.braangomodel.AccountCreateRequestInput;
import com.braango.client.braangomodel.AccountInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.ResponseHeader;

/**
 * @author braango
 * 
 *         Code to create virtual dealer for partner having valid auth_token
 * 
 *         Auth token of master account is generated by sales team. Allows master
 *         account holder to manage either partner_dealer(s) or real
 *         hierarchical dealers. This example assumes virtual dealer mode where
 *         master account is simply container to hold
 *         "partner_dealer (virtual dealer)" account "partner_dealer" account
 *         acts as empty proxy dealership
 * 
 *         "partner_dealer" will hold dealers which are called "subDealers" and
 *         their personnel
 *
 */
public class CreateVirtualDealer {

	static String basePath = "https://testapi2.braango.com/v2/braango";
	/**
	 * 
	 */
	public CreateVirtualDealer() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	
		ApiClient braangoApiClient = new ApiClient();
		String    authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact sales@braango.com to have one created for you
        
		// Create object to create partnerDealer
		
		AccountCreateRequestInput partnerDealer = new AccountCreateRequestInput();
	 
		RequestHeader hdr = new RequestHeader();
		hdr.apiKey(authToken);                   // This api key is actually authorization key to enable various features
		
		hdr.setAccountType("partner");           // For channel partner, integrator, this value is partner, else dealer for business directly
		                                         // using this api
		
		hdr.setId("create-partner-dealer-p5");   // This id for your tracking, will be reflected back in response. Doesn't get used by Braango
		                                         // If not speficied, braango will return session-id in its response
		
		partnerDealer.setHeader(hdr);
		
		AccountInput bdy = new AccountInput();   // Actual body of the virtual dealer object
		
		bdy.setBusinessName("partner p5");       // Business name - Required. Needs to be unique within
		                                         // Braango system. Braango will return error code if 
		                                         // name conflicts
		
		bdy.setUserName("partnerp5");           // username is needed for dashboard login and in future 
		                                         // will be used for basic auth - Required
		
		bdy.setPassword("p5Partner$");
		                                         
		bdy.setFirstName("partner");             // First name of authorized user - Required
		bdy.setLastName("partner");              // Last  name of authorized user - Required
		bdy.setEmail("partner@partner.com");     // Required
		bdy.setCellPhone("4088907723");          // Required
		bdy.setPackage("Franchise");             // For virtual dealer, always select enterprise
		bdy.setVirtualDealer(true);              // Creating virtual dealer - Optional
		
		partnerDealer.setBody(bdy);
		
		
		braangoApiClient.setBasePath(basePath);
		braangoApiClient.setApiKey(authToken);   // Lower level api_key . This is the auth_token created by sales_team
		                                         // This is actually authentication token
		
		
		
		AccountsApi  partnerDealerApi             
		                 = new AccountsApi(braangoApiClient); // Actual api that has calls to create virtual dealer 
		
		try {
			AccountCreateOutputWrapper virtualDealer = partnerDealerApi.createPartnerDealer(partnerDealer);
			if(virtualDealer != null) {
				// Extract out the hdr and body 
				ResponseHeader respHdr = virtualDealer.getHeader();
				if(respHdr != null) {
					String respId = respHdr.getId();
					UUID braangoRequestId 
					              = respHdr.getIsnRequestId(); // Braango request tracker
					System.out.println("Response ID = " + respId  + " request tracker id = " + braangoRequestId.toString());
				}
				AccountCreateOutputWrapperBody respBdy = virtualDealer.getBody();
				if(respBdy != null) {
					String status = respBdy.getStatus();
					// Typically this value should be always SUCCESS else exception will be thrown
					// Sometimes, this can be WARNING to indicate if any resource conflicted or not
					// In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
					System.out.println("Status = " + status);
					
					// Actuall response data
					AccountCreateOutputWrapperBodyData data = respBdy.getData();
					
					String partnerDealerId                  = data.getDealerId(); // This is internal dealerId within braango system
					                                                              // assigned to virtualDealer (partnerDealer)
					String partnerDealerApiKey              = data.getDealerApiKey(); // This is critical key that needs to be
					                                                                  // supplied as apiKey in all subsequent
					                                                                  // requests to other APIs. This authorizes
					                                                                  // partnerDealer within braango system
					                                                                  // 
					                                                                  // Note this is different from auth_token
					                                                                  // that authenticates partnerDealer and 
					                                                                  // needs to be set in ApiClient via setApiKey 
					                                                                  // (braangoApiClient)
					                                                                  // 
					
					Integer dealerPkId                      = data.getDealerPkId();   // Internal ID used in Braango system
					
					System.out.println("Partner Dealer Api Key = " + partnerDealerApiKey + "Partner Dealer Id = " + partnerDealerId );
				}
			}
		} catch (ApiException e) {
			e.printStackTrace();
			System.out.println("HTTP ERROR CODE = " + e.getCode() + "DETAILED MESSAGE = " + e.getResponseBody()) ;
			
		}
		
	
		
	}

}

This api call creates the personnel for the current virtual dealer.

This call creates sub_dealer_master_personnel i.e. sub dealer master account. This account typically is assigned to Manager of the location or can be abstract entity. However this account has privileges to create groups that other personnel can subscribe too.

Personnel is the master resource in braango system. It consists of following sub-resources

  • SMS
  • VOICE
  • EMAIL/CRM EMAIL
  • BANNERS
  • FOOTERS
  • GROUPS
  • SUPERVISORS
  • CRM OBJECT
  • WEB HOOKS

Either the consumer of this API can create and update entire personnel object or create bits and pieces and update the sub_resources as an when needed. For the benefit of developer, majority of sub_resouces of personnel entity are exposed via api too

/**
 * 
 */
package com.braango.virtualdealer;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.PersonnelsApi;
import com.braango.client.braangomodel.HeaderResponse;
import com.braango.client.braangomodel.PersonnelOutputWrapper;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SubDealerBody;
import com.braango.client.braangomodel.SubDealerRequestInput;

/**
 * @author braango
 * 
 *         Sample code showing how to create subDealer
 *
 */
public class CreateSubDealer {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		String authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact
												// sales@braango.com to have one
												// created for you
		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";

		PersonnelsApi personnelsApi = new PersonnelsApi(braangoApiClient);

		// Create subDealer . subDealer is actually the business
		// that virtual dealer is hosting.
		//

		ApiCallback<PersonnelOutputWrapper> callBack = new ApiCallback<PersonnelOutputWrapper>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(PersonnelOutputWrapper result,
					int statusCode, Map<String, List<String>> responseHeaders) {

				
				UUID salesPersonId = result.getBody().getData().getSalesPersonId();
				
				System.out.println("SUCCESS : SalespersonID = " + salesPersonId.toString());

				
			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());
				

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		// SubDealerRequestInput wraps RequestHeader and subDealerBody
		SubDealerRequestInput subDealerRequestInput = new SubDealerRequestInput();

		/*
		 * { "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
		// accounts

		hdr.setAccountType("partner");

		// dealer_api_key returned
		// when partner_dealer was created

		hdr.setApiKey(apiKey);

		// ID that will be reflected back
		hdr.setId("create-sub-dealer-s1002");
		subDealerRequestInput.setHeader(hdr);

		SubDealerBody body = new SubDealerBody();

		// REQUIRED FIELDS

		// Required field . Used for
		// SMS login in to the UI
		// For Braango Enterprise, this is don't care
		// unless partner implements UI with SMS login
		body.setSmsLogin(false);
		

		body.setDealerName("test dealer s1002");

		// Create SubDealer creates full functional
		// braango personnel with added capability
		// Provide personnel name that is typical
		// contact point
		body.setPersonnelName("name of manager");

		/*
		 * This is a user name created while signing this personnel up.
		 * Typically this user name can be used to log into the braango UI.
		 * However for whitelabel product, it is expected that this will be used
		 * for single signon with respect to dealer account on partner system.
		 * i.e. it is expected that partner will pass on the same user name that
		 * dealer has on its system to give seamless integration experience.
		 */
		body.setUserName("subdealers1002r1");

		/*
		 * Password will be encrypted with SHA-25 and base64 encoded and stored
		 * internally within the braango system. pattern:
		 * ^(?=^.{6,10}$)(?=.*\d)(
		 * ?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{&quot
		 * ;:;'?/>.<,])(?!.*\s).*$
		 * 
		 * Used for single sign on. needs to 6-10 characters with one capital,
		 * one numberal and one special character
		 */
		body.setPassword("test1T$");

		/*
		 * pattern: ^(?:Starter|Small Business|Rooftop|Franchise)$
		 * 
		 * Every sub_dealer needs to have braango package
		 */
		body.setPackage("Small Business");

		// Required field. Indicates the
		// ID for this business
		// All internal resources, leads, personnel,
		// braango number are associated with this id
		// Needs to be unique within Braango system
		//
		// Will return error if there is clash
		//
		// Recommended to use unique naming convention
		// or UUID string

		body.setSubDealerId("subdealers1002");

		// OPTIONAL FIELDS

		// List of banners. Braango will
		// randomly choose one when sending
		// message to dealer via SMS
		//
		List<String> dealerBanners = new ArrayList<String>();
		dealerBanners.add("s1002db1");
		body.setDealerBanners(dealerBanners);

		// List of client banners. Braango
		// will randomly choose one when
		// sending dealer messages to client
		List<String> clientBanners = new ArrayList<String>();
		clientBanners.add("s1002cb1");
		body.setClientBanners(clientBanners);

		// List of supervisor banners. Braango
		// will randomly choose one when
		// sending messages to supervisor
		List<String> supervisorBanners = new ArrayList<String>();
		supervisorBanners.add("s1002sb1");
		body.setSupervisorBanners(supervisorBanners);

		// List of dealer footers. Braango will
		// randomly choose one when sending
		// message to dealer via SMS
		//
		List<String> dealerFooters = new ArrayList<String>();
		dealerFooters.add("s1002df1");
		body.setDealerFooters(dealerFooters);

		// List of client footers. Braango
		// will randomly choose one when
		// sending dealer messages to client
		List<String> clientFooters = new ArrayList<String>();
		clientFooters.add("s1002cf1");
		body.setClientFooters(clientFooters);

		// List of supervisor footers. Braango
		// will randomly choose one when
		// sending messages to supervisor
		List<String> supervisorFooters = new ArrayList<String>();
		supervisorBanners.add("s1002sf1");
		body.setSupervisorFooters(supervisorFooters);

		String email = "s1002r1@subdealer1002.com";
		body.setEmail(email);

		// If email specified is that for
		// CRM email (ADF XML compliant)
		
		Boolean typeAdfCRMEmail = false;
		body.setTypeAdfCrm(typeAdfCRMEmail);
		
		/*
		 * Number where dealer's root account can be reached via SMS
		 * for leads
		 *  
		 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
		 */
		String smsNumber = "4089763433";
		body.setSmsNumber(smsNumber);

		
		/*
		 * Number where dealer's root account can be reached via voice 
		 * for leads
		 * 
		 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
		 * 
		 */
		
		String phoneNumber = "4089763433";
		body.setPhoneNumber(phoneNumber);
		
		// SubDealer's can create unique groups
		// that personnel can subscribe to
		
		String group = "s1002grp";
		body.setGroup(group);
		
		subDealerRequestInput.setBody(body);
		
		try {
			personnelsApi.createSubDealerAsync(subDealerRequestInput, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

This api call creates the personnel for the current sub_dealer.

Personnel is the master resource in braango system. It consists of following sub-resources

  • SMS
  • VOICE
  • EMAIL/CRM EMAIL
  • BANNERS
  • FOOTERS
  • GROUPS
  • SUPERVISORS
  • CRM OBJECT
  • WEB HOOK

Either the consumer of this API can create and update entire personnel object or create bits and pieces and update the sub_resources as an when needed. For the benefit of developer, majority of sub_resouces of personnel entity are exposed via API

/**
 * 
 */
package com.braango.virtualdealer;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.PersonnelsApi;
import com.braango.client.braangomodel.HeaderResponse;
import com.braango.client.braangomodel.PersonnelOutputWrapper;
import com.braango.client.braangomodel.PersonnelRequest;
import com.braango.client.braangomodel.PersonnelRequestInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SubDealerBody;
import com.braango.client.braangomodel.SubDealerRequestInput;

/**
 * @author braango
 * 
 *         Sample code showing how to create subDealer
 *
 */
public class CreatePersonnel {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		String authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact
												// sales@braango.com to have one
												// created for you
		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 
		PersonnelsApi personnelsApi = new PersonnelsApi(braangoApiClient);

		

		ApiCallback<PersonnelOutputWrapper> callBack = new ApiCallback<PersonnelOutputWrapper>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(PersonnelOutputWrapper result,
					int statusCode, Map<String, List<String>> responseHeaders) {

				
				UUID salesPersonId = result.getBody().getData().getSalesPersonId();
				
				System.out.println("SUCCESS : SalespersonID = " + salesPersonId.toString());

				
			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());
				

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		// PersonnelRequestInput wraps RequestHeader and personnelRequestBody
		PersonnelRequestInput personnelRequestInput = new PersonnelRequestInput();

		/*
		 * { "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
		// accounts

		hdr.setAccountType("partner");

		// dealer_api_key returned
		// when partner_dealer was created

		hdr.setApiKey(apiKey);

		// ID that will be reflected back
		hdr.setId("create-personnel-s1002r3");
		personnelRequestInput.setHeader(hdr);

		PersonnelRequest body = new PersonnelRequest();

		// REQUIRED FIELDS

		// Required field . Used for
		// SMS login in to the UI
		// For Braango Enterprise, this is don't care
		// unless partner implements UI with SMS login
		body.setSmsLogin(false);
		


		body.setPersonnelName("personnel rep3");

		/*
		 * This is a user name created while signing this personnel up.
		 * Typically this user name can be used to log into the braango UI.
		 * However for whitelabel product, it is expected that this will be used
		 * for single signon with respect to dealer account on partner system.
		 * i.e. it is expected that partner will pass on the same user name that
		 * dealer has on its system to give seamless integration experience.
		 */
		body.setUserName("subdealers1002r3");

		/*
		 * Password will be encrypted with SHA-25 and base64 encoded and stored
		 * internally within the braango system. pattern:
		 * ^(?=^.{6,10}$)(?=.*\d)(
		 * ?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{&quot
		 * ;:;'?/>.<,])(?!.*\s).*$
		 * 
		 * Used for single sign on. needs to 6-10 characters with one capital,
		 * one numberal and one special character
		 */
		body.setPassword("test1T$");

		

		// OPTIONAL FIELDS

		// List of banners. Braango will
		// randomly choose one when sending
		// message to dealer via SMS
		//
		List<String> dealerBanners = new ArrayList<String>();
		dealerBanners.add("s1002r3db1");
		body.setDealerBanners(dealerBanners);

		// List of client banners. Braango
		// will randomly choose one when
		// sending dealer messages to client
		List<String> clientBanners = new ArrayList<String>();
		clientBanners.add("s1002r3cb1");
		body.setClientBanners(clientBanners);

		// List of supervisor banners. Braango
		// will randomly choose one when
		// sending messages to supervisor
		List<String> supervisorBanners = new ArrayList<String>();
		supervisorBanners.add("s1002r3sb1");
		body.setSupervisorBanners(supervisorBanners);

		// List of dealer footers. Braango will
		// randomly choose one when sending
		// message to dealer via SMS
		//
		List<String> dealerFooters = new ArrayList<String>();
		dealerFooters.add("s1002r3df1");
		body.setDealerFooters(dealerFooters);

		// List of client footers. Braango
		// will randomly choose one when
		// sending dealer messages to client
		List<String> clientFooters = new ArrayList<String>();
		clientFooters.add("s1002r3cf1");
		body.setClientFooters(clientFooters);

		// List of supervisor footers. Braango
		// will randomly choose one when
		// sending messages to supervisor
		List<String> supervisorFooters = new ArrayList<String>();
		supervisorBanners.add("s1002r3sf1");
		body.setSupervisorFooters(supervisorFooters);

		String email = "s1002r3@subdealer1002.com";
		body.setEmail(email);

		// If email specified is that for
		// CRM email (ADF XML compliant)
		
		Boolean typeAdfCRMEmail = false;
		body.setTypeAdfCrm(typeAdfCRMEmail);
		
		/*
		 * Number where personnel can be reached via SMS
		 * for leads
		 *  
		 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
		 */
		String smsNumber = "4089763435";
		body.setSmsNumber(smsNumber);

		
		/*
		 * Number where personnel can be reached via voice 
		 * for leads
		 * 
		 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
		 * 
		 */
		
		String phoneNumber = "4089763435";
		body.setPhoneNumber(phoneNumber);
		
		//Subscribe to the group
		String group = "s1002grp";
		body.setGroup(group);
		
		personnelRequestInput.setBody(body);
		
		try {
			String subDealerId = "subdealers1002";
			personnelsApi.createPersonnelAsync(subDealerId,personnelRequestInput, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

This api call is used to update personnel for additions. Practically all the fields of the personnel that are necessary for functioning as braango personnel can be updated to add more except for supervisor. Supervisor needs to be updated,created using a seperate API call

Note This call will be used to only add additional fields. To actually delete unwanted fields, please use appropiate sub_resource calls

/**
 * 
 */
package com.braango.virtualdealer;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.PersonnelsApi;
import com.braango.client.braangomodel.HeaderResponse;
import com.braango.client.braangomodel.PersonnelOutputWrapper;
import com.braango.client.braangomodel.PersonnelRequest;
import com.braango.client.braangomodel.PersonnelRequestInput;
import com.braango.client.braangomodel.PersonnelUpdate;
import com.braango.client.braangomodel.PersonnelUpdateRequestInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SubDealerBody;
import com.braango.client.braangomodel.SubDealerRequestInput;

/**
 * @author braango
 * 
 *         Sample code showing how to create subDealer
 *
 */
public class UpdatePersonnel {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		String authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact
												// sales@braango.com to have one
												// created for you
		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 
		PersonnelsApi personnelsApi = new PersonnelsApi(braangoApiClient);

		

		ApiCallback<PersonnelOutputWrapper> callBack = new ApiCallback<PersonnelOutputWrapper>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(PersonnelOutputWrapper result,
					int statusCode, Map<String, List<String>> responseHeaders) {

				
				UUID salesPersonId = result.getBody().getData().getSalesPersonId();
				
				System.out.println("SUCCESS : Updated SalespersonID = " + salesPersonId.toString());

				
			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());
				

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		// PersonnelUpdateInput wraps RequestHeader and personnelUpdate
		PersonnelUpdateRequestInput personnelRequestInput = new PersonnelUpdateRequestInput();

		/*
		 * { "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
		// accounts

		hdr.setAccountType("partner");

		// dealer_api_key returned
		// when partner_dealer was created

		hdr.setApiKey(apiKey);

		// ID that will be reflected back
		hdr.setId("create-personnel-s1002r2");
		personnelRequestInput.setHeader(hdr);

		PersonnelUpdate body = new PersonnelUpdate();

		// REQUIRED FIELDS

		// Required field . Used for
		// SMS login in to the UI
		// For Braango Enterprise, this is don't care
		// unless partner implements UI with SMS login
		body.setSmsLogin(false);
		



		/*
		 * Password will be encrypted with SHA-25 and base64 encoded and stored
		 * internally within the braango system. pattern:
		 * ^(?=^.{6,10}$)(?=.*\d)(
		 * ?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{&quot
		 * ;:;'?/>.<,])(?!.*\s).*$
		 * 
		 * Used for single sign on. needs to 6-10 characters with one capital,
		 * one numberal and one special character
		 * 
		 * Chaning the password for the update call
		 * 
		 */
		body.setPassword("test2T$");

		

		// OPTIONAL FIELDS

		// List of banners. Braango will
		// randomly choose one when sending
		// message to dealer via SMS
		//
		List<String> dealerBanners = new ArrayList<String>();
		dealerBanners.add("s1002r2db1updated");
		body.setDealerBanners(dealerBanners);

		// List of client banners. Braango
		// will randomly choose one when
		// sending dealer messages to client
		List<String> clientBanners = new ArrayList<String>();
		clientBanners.add("s1002r2cb1updated");
		body.setClientBanners(clientBanners);

		// List of supervisor banners. Braango
		// will randomly choose one when
		// sending messages to supervisor
		List<String> supervisorBanners = new ArrayList<String>();
		supervisorBanners.add("s1002r2sb1updated");
		body.setSupervisorBanners(supervisorBanners);

		// List of dealer footers. Braango will
		// randomly choose one when sending
		// message to dealer via SMS
		//
		List<String> dealerFooters = new ArrayList<String>();
		dealerFooters.add("s1002r2df1updated");
		body.setDealerFooters(dealerFooters);

		// List of client footers. Braango
		// will randomly choose one when
		// sending dealer messages to client
		List<String> clientFooters = new ArrayList<String>();
		clientFooters.add("s1002r2cf1updated");
		body.setClientFooters(clientFooters);

		// List of supervisor footers. Braango
		// will randomly choose one when
		// sending messages to supervisor
		List<String> supervisorFooters = new ArrayList<String>();
		supervisorBanners.add("s1002r2sf1updated");
		body.setSupervisorFooters(supervisorFooters);

		String email = "s1002r2@subdealer1002.com";
		body.setEmail(email);

		// If email specified is that for
		// CRM email (ADF XML compliant)
		
		Boolean typeAdfCRMEmail = false;
		body.setTypeAdfCrm(typeAdfCRMEmail);
		
		/*
		 * Number where personnel can be reached via SMS
		 * for leads
		 *  
		 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
		 */
		String smsNumber = "4089763434";
		body.setSmsNumber(smsNumber);

		
		/*
		 * Number where personnel can be reached via voice 
		 * for leads
		 * 
		 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
		 * 
		 */
		
		String phoneNumber = "4089763434";
		body.setPhoneNumber(phoneNumber);
		
		//Subscribe to the group
		String group = "s1002grp";
		body.setGroup(group);
		
		personnelRequestInput.setBody(body);
		
		try {
			String subDealerId = "subdealers1002";
			
			// Existing salesperson 
			String salesPersonId = "c8e7f607-24b7-4805-a007-7482e9938d1e";
			personnelsApi.updatePersonnelAsync(subDealerId,salesPersonId,personnelRequestInput, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

This api call returns the personnel that was created under subDealer represented by subdealerid. Personnel ID needs to be provided

/**
 * 
 */
package com.braango.virtualdealer;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.PersonnelsApi;
import com.braango.client.braangomodel.HeaderResponse;
import com.braango.client.braangomodel.PersonnelOutputWrapper;
import com.braango.client.braangomodel.PersonnelRequest;
import com.braango.client.braangomodel.PersonnelRequestInput;
import com.braango.client.braangomodel.PersonnelUpdate;
import com.braango.client.braangomodel.PersonnelUpdateRequestInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SubDealerBody;
import com.braango.client.braangomodel.SubDealerRequestInput;

/**
 * @author braango
 * 
 *         Sample code showing how to create subDealer
 *
 */
public class GetPersonnelDetails {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		String authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact
												// sales@braango.com to have one
												// created for you
		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 
		PersonnelsApi personnelsApi = new PersonnelsApi(braangoApiClient);

		

		ApiCallback<PersonnelOutputWrapper> callBack = new ApiCallback<PersonnelOutputWrapper>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(PersonnelOutputWrapper result,
					int statusCode, Map<String, List<String>> responseHeaders) {

				
				UUID salesPersonId = result.getBody().getData().getSalesPersonId();
				
				System.out.println("SUCCESS : Updated SalespersonID = " + salesPersonId.toString());
				System.out.println("DETAILS : " + result);

				
			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());
				

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		
		try {
			String subDealerId = "subdealers1002";
			
			// Existing salesperson 
			String salesPersonId = "c8e7f607-24b7-4805-a007-7482e9938d1e";
			String accountType   = "partner";
			personnelsApi.getPersonnelAsync(subDealerId,salesPersonId,apiKey,accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

This api call returns the details of all personnel represented by given sub_dealer

/**
 * 
 */
package com.braango.virtualdealer;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.PersonnelsApi;
import com.braango.client.braangomodel.HeaderResponse;
import com.braango.client.braangomodel.PersonnelOutputListWrapper;
import com.braango.client.braangomodel.PersonnelOutputWrapper;
import com.braango.client.braangomodel.PersonnelRequest;
import com.braango.client.braangomodel.PersonnelRequestInput;
import com.braango.client.braangomodel.PersonnelUpdate;
import com.braango.client.braangomodel.PersonnelUpdateRequestInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SubDealerBody;
import com.braango.client.braangomodel.SubDealerRequestInput;

/**
 * @author braango
 * 
 * Sample code to fetch all personnel given a subDealerId
 *
 */
public class GetAllPersonnelDetailsPerSubDealer {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		String authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact
												// sales@braango.com to have one
												// created for you
		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 
		PersonnelsApi personnelsApi = new PersonnelsApi(braangoApiClient);

		

		ApiCallback<PersonnelOutputListWrapper> callBack = new ApiCallback<PersonnelOutputListWrapper>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(PersonnelOutputListWrapper result,
					int statusCode, Map<String, List<String>> responseHeaders) {

				System.out.println("DETAILS : " + result);

				
			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());
				

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		
		try {
			String subDealerId = "subdealers1002";
			
			// Existing salesperson 
			String salesPersonId = "c8e7f607-24b7-4805-a007-7482e9938d1e";
			String accountType   = "partner";
			personnelsApi.getPersonnelsPerSubDealerAsync(subDealerId, apiKey, accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

This api call returns the details of all personnel for given virtual dealer or partner dealer.

/**
 * 
 */
package com.braango.virtualdealer;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.PersonnelsApi;
import com.braango.client.braangomodel.HeaderResponse;
import com.braango.client.braangomodel.PersonnelOutputListAllSubDealersWrapper;
import com.braango.client.braangomodel.PersonnelOutputListWrapper;
import com.braango.client.braangomodel.PersonnelOutputWrapper;
import com.braango.client.braangomodel.PersonnelRequest;
import com.braango.client.braangomodel.PersonnelRequestInput;
import com.braango.client.braangomodel.PersonnelUpdate;
import com.braango.client.braangomodel.PersonnelUpdateRequestInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SubDealerBody;
import com.braango.client.braangomodel.SubDealerRequestInput;

/**
 * @author braango
 * 
 * Sample code to fetch all personnel for virtual dealer
 */
public class GetAllPersonnelDetails {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		String authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact
												// sales@braango.com to have one
												// created for you
		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 
		PersonnelsApi personnelsApi = new PersonnelsApi(braangoApiClient);

		

		ApiCallback<PersonnelOutputListAllSubDealersWrapper> callBack = new ApiCallback<PersonnelOutputListAllSubDealersWrapper>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(PersonnelOutputListAllSubDealersWrapper result,
					int statusCode, Map<String, List<String>> responseHeaders) {

				System.out.println("DETAILS : " + result);

				
			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());
				

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		
		try {
			String subDealerId = "subdealers1002";
			
			// Existing salesperson 
			String salesPersonId = "c8e7f607-24b7-4805-a007-7482e9938d1e";
			String accountType   = "partner";
			personnelsApi.getAllPersonnelForDealerAsync(apiKey, accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.PersonnelsApi;
import com.braango.client.braangomodel.HeaderResponse;
import com.braango.client.braangomodel.PersonnelOutputWrapper;
import com.braango.client.braangomodel.PersonnelRequest;
import com.braango.client.braangomodel.PersonnelRequestInput;
import com.braango.client.braangomodel.PersonnelUpdate;
import com.braango.client.braangomodel.PersonnelUpdateRequestInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SubDealerBody;
import com.braango.client.braangomodel.SubDealerRequestInput;

/**
 * @author braango
 * 
 *   Sample code to delete personnel details
 *   
 *   Deleting personnel wipes out all the entries from the system
 *   Though user name cannot be deleted for security reasons
 *
 */
public class DeletePersonnelDetails {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		String authToken = "ISNWF0P30WM0CMK"; // TEST auth token. Please contact
												// sales@braango.com to have one
												// created for you
		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 
		PersonnelsApi personnelsApi = new PersonnelsApi(braangoApiClient);

		

		ApiCallback<PersonnelOutputWrapper> callBack = new ApiCallback<PersonnelOutputWrapper>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(PersonnelOutputWrapper result,
					int statusCode, Map<String, List<String>> responseHeaders) {

				
				UUID salesPersonId = result.getBody().getData().getSalesPersonId();
				
				System.out.println("SUCCESS : Deleted details of SalespersonID = " + salesPersonId.toString());
				System.out.println("DETAILS : " + result);

				
			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());
				

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		
		try {
			String subDealerId = "subdealers1002";
			
			// Existing salesperson 
			String salesPersonId = "c8e7f607-24b7-4805-a007-7482e9938d1e";
			String accountType   = "partner";
			personnelsApi.deletePersonnelAsync(subDealerId,salesPersonId,apiKey,accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

Use this call to create a partner dealer account into the braango system. Typically this could be a real dealership or it could be virtual dealer created by channel partner. The partner dealer account can hold more than 1 sub dealers based on package selected.

sub dealers are entities that have privileges to add personnel, create supervisors, create groups etc.

In virual dealer mode, typically sub dealer will be actual business the partner is registering with the braango system.

In real dealer mode, sub dealer could be a location

Note sub dealer are actually personnel with full privileges. Typically businesses can use general manager personnel for sub dealer details

Typically based on channel partner’s business model, either channel partner can create a virtual dealer and have all of his clients as sub dealers. This allows for single dashboad managent for partner’s all dealers. Further more, this model allows tighter control over some global resources that channel partner may want to employ. To use this model, please select package “Enterprise”. Currently for each virtual dealer, there can be 3000 sub dealers created.

Virtual dealer model is highly recommended for braango leads product. Further more virutal dealer model allows for flat hierarchy –> Virtual Dealer->Sub Dealer->Personnel.

For virtual dealer model, each franhcise location will be created as separate sub-dealer

For real dealer model i.e channel partner creating a real dealer account is good for scenarios where franchise dealers want their own hierarchy and single dashboard.

<?php
use Braango\braangomodel as model;
use Braango\braangomodel\RequestHeader as rhdr;
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Code to create virtual dealer for partner having valid auth_token
 *        
 *         Auth token of master account is generated by sales team. Allows master
 *         account holder to manage either partner_dealer(s) or real
 *         hierarchical dealers. This example assumes virtual dealer mode where
 *         master account is simply container to hold
 *         "partner_dealer (virtual dealer)" account "partner_dealer" account
 *         acts as empty proxy dealership
 *        
 *         "partner_dealer" will hold dealers which are called "subDealers" and
 *         their personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\AccountsApi();

// Braango\braangomodel\AccountCreateRequestInput |
$partnerDealer = new \Braango\braangomodel\AccountCreateRequestInput(); 


/*
 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
 * "account_type": "partner" }
 */
$requestHdr = new rhdr();

// Set the account type to partner for
// virtual dealer and partner hosted
// accounts

$requestHdr->setAccountType("partner");

// This id for your tracking, will be reflected back in response.
// Doesn't get used by Braango
// If not speficied, braango will return session-id in its response

$requestHdr->setId("create-partner-dealer-p7");


$partnerDealer->setHeader($requestHdr);


// Actual body of the virtual dealer object
$bdy = new model\AccountInput();


// Business name - Required. Needs to be unique within
// Braango system. Braango will return error code if
// name conflicts
$bdy->setBusinessName("partner p7");


// username is needed for dashboard login and in future
// will be used for basic auth - Required
$bdy->setUserName("partnerp7");


$bdy->setPassword("p7Partner$");


// First name of authorized user - Required
$bdy->setFirstName("partnerp7");


// Last name of authorized user - Required
$bdy->setLastName("partnerp7");


// Required
$bdy->setEmail("partner@partner7.com");


// Required
$bdy->setCellPhone("4087651235");


// Required
// For virtual dealer, always select enterprise
$bdy->setPackage("Franchise");


// Creating virtual dealer - Optional
$bdy->setVirtualDealer(true);


$partnerDealer->setBody($bdy);

try {
    $result = $api_instance->createPartnerDealer($partnerDealer);
   
    if ($result != null) {
        
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
           
            $rspId = $rspHdr->getId();
            
            // Braango request tracker
            $braangoRequestId = $rspHdr->getIsnRequestId();
           
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
       
        if ($rspBdy != null) {
           
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "/n");
            
            // Actuall response data
            $data = $rspBdy->getData();
            
            // This is internal dealerId within braango system
            // assigned to virtualDealer (partnerDealer)
            $partnerDealerId = $data->getDealerId();
            
            // This is critical key that needs to be
            // supplied as apiKey in all subsequent
            // requests to other APIs. This authorizes
            // partnerDealer within braango system
            //
            // Note this is different from auth_token
            // that authenticates partnerDealer and
            // needs to be set in ApiClient via setApiKey
            // (braangoApiClient)
            //
            $partnerDealerApiKey = $data->getDealerApiKey();
            
            print_r("Partner Dealer ID = " . $partnerDealerId . "\n");
            
            print_r("Partner Dealer API Key = " . $partnerDealerApiKey . "\n");
        }
    }
} catch (Exception $e) {
    
    echo 'Exception when calling AccountsApi->createPartnerDealer: ', $e->getMessage(), PHP_EOL;
}
?>

This api call creates the personnel for the current virtual dealer.

This call creates sub_dealer_master_personnel i.e. sub dealer master account. This account typically is assigned to Manager of the location or can be abstract entity. However this account has privileges to create groups that other personnel can subscribe too.

Personnel is the master resource in braango system. It consists of following sub-resources

  • SMS
  • VOICE
  • EMAIL/CRM EMAIL
  • BANNERS
  • FOOTERS
  • GROUPS
  • SUPERVISORS
  • CRM OBJECT
  • WEB HOOKS

Either the consumer of this API can create and update entire personnel object or create bits and pieces and update the sub_resources as an when needed. For the benefit of developer, majority of sub_resouces of personnel entity are exposed via api too

<?php
use Braango\braangoapi\BraangonumbersApi;
use Braango\braangomodel as model;
use Braango\braangomodel\RequestHeader as rhdr;

require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to create subDealer
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\PersonnelsApi();

// Braango\braangomodel\SubDealerRequestInput |
$subDealerRequestInput = new \Braango\braangomodel\SubDealerRequestInput();

$typeAdfCRMEmail = FALSE;


/*
 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
 * "account_type": "partner" }
 */
$hdr = new rhdr();

// Set the account type to partner for
// virtual dealer and partner hosted
// accounts
$hdr->setAccountType("partner");

// dealer_api_key returned
// when partner_dealer was created
$hdr->setApiKey("ISNMdzuNiKG7jhl9d9v");

// ID that will be reflected back
$hdr->setId("create-sub-dealer-s2002");

$subDealerRequestInput->setHeader($hdr);

// Subdealer request body
$subDealerBody = new model\SubDealerBody();

// REQUIRED FIELDS

// Required field . Used for
// SMS login in to the UI
// For Braango Enterprise, this is don't care
// unless partner implements UI with SMS login
$subDealerBody->setSmsLogin(FALSE);

$subDealerBody->setDealerName("test dealer s2002");

// Create SubDealer creates full functional
// braango personnel with added capability
// Provide personnel name that is typical
// contact point
$subDealerBody->setPersonnelName("name of manager");

/*
 * This is a user name created while signing this personnel up.
 * Typically this user name can be used to log into the braango UI.
 * However for whitelabel product, it is expected that this will be used
 * for single signon with respect to dealer account on partner system.
 * i.e. it is expected that partner will pass on the same user name that
 * dealer has on its system to give seamless integration experience.
 */
$subDealerBody->setUserName("subdealer2002r1");

/*
 * Password will be encrypted with SHA-25 and base64 encoded and stored
 * internally within the braango system. pattern:
 * ^(?=^.{6,10}$)(?=.*\d)(
 * ?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{&quot
 * ;:;'?/>.<,])(?!.*\s).*$
 *
 * Used for single sign on. needs to 6-10 characters with one capital,
 * one numberal and one special character
 */
$subDealerBody->setPassword("test1T$");

/*
 * pattern: ^(?:Starter|Small Business|Rooftop|Franchise)$
 *
 * Every sub_dealer needs to have braango package
 */

$subDealerBody->setPackage("Small Business");

// Required field. Indicates the
// ID for this business
// All internal resources, leads, personnel,
// braango number are associated with this id
// Needs to be unique within Braango system
//
// Will return error if there is clash
//
// Recommended to use unique naming convention
// or UUID string
$subDealerBody->setSubDealerId("subdealers2002");

$subDealerBody->setEmail("s2002r1@subdealer2002.com");

// If email specified is that for
// CRM email (ADF XML compliant)
$subDealerBody->setTypeAdfCrm($typeAdfCRMEmail);

/*
 * Number where dealer's root account can be reached via SMS
 * for leads
 *
 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
 */
$subDealerBody->setPhoneNumber('4089763433');

/*
 * Number where dealer's root account can be reached via SMS
 * for leads
 *
 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
 */
$subDealerBody->setSmsNumber('4089763433');

// List of dealer banners. Braango will
// randomly choose one when sending
// message to dealer via SMS
//
$dealerBanners = array(
    "s2002db1"
);
$subDealerBody->setDealerBanners($dealerBanners);

// List of client banners. Braango
// will randomly choose one when
// sending dealer messages to client
$clientBanners = array(
    's2002cb1'
);
$subDealerBody->setClientBanners($clientBanners);

// List of dealer footers. Braango will
// randomly choose one when sending
// message to dealer via SMS
//

$dealerFooters = array(
    's2002df1'
);
$subDealerBody->setDealerFooters($dealerFooters);

// List of client footers. Braango
// will randomly choose one when
// sending dealer messages to client
$clientFooters = array(
    's2002cf1'
);
$subDealerBody->setClientFooters($clientFooters);

// List of supervisor banners. Braango
// will randomly choose one when
// sending messages to supervisor
$supervisorBanners = array(
    's2002sb1'
);
$subDealerBody->setSupervisorBanners($supervisorBanners);

// List of supervisor footers. Braango
// will randomly choose one when
// sending messages to supervisor
$supervisorFooters = array(
    's2002sf1'
);
$subDealerBody->setSupervisorFooters($supervisorFooters);

// SubDealer's can create unique groups
// that personnel can subscribe to
$subDealerBody->setGroup('s2002g');

$subDealerRequestInput->setBody($subDealerBody);

try {
    $result = $api_instance->createSubDealer($subDealerRequestInput);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $salesPersonId = $rspBdy->getData()->getSalesPersonId();
            
            print_r("SUCCESS : SalespersonID = " . $salesPersonId);
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling PersonnelsApi->createSubDealer: ', $e->getMessage(), PHP_EOL;
}
?>

This api call creates the personnel for the current sub_dealer.

Personnel is the master resource in braango system. It consists of following sub-resources

  • SMS
  • VOICE
  • EMAIL/CRM EMAIL
  • BANNERS
  • FOOTERS
  • GROUPS
  • SUPERVISORS
  • CRM OBJECT
  • WEB HOOK

Either the consumer of this API can create and update entire personnel object or create bits and pieces and update the sub_resources as an when needed. For the benefit of developer, majority of sub_resouces of personnel entity are exposed via API

<?php
use Braango\braangomodel as model;
use Braango\braangomodel\RequestHeader as rhdr;

require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to create subDealer
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\PersonnelsApi();

// string | id of _sub_dealer_
$subdealerid = "subdealers2002";

// Braango\braangomodel\PersonnelRequestInput |
$personnelRequestInput = new \Braango\braangomodel\PersonnelRequestInput();

$typeAdfCRMEmail = FALSE;


/*
 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
 * "account_type": "partner" }
 */
$hdr = new rhdr();

// Set the account type to partner for
// virtual dealer and partner hosted
// accounts
$hdr->setAccountType("partner");

// dealer_api_key returned
// when partner_dealer was created
$hdr->setApiKey("ISNMdzuNiKG7jhl9d9v");

// ID that will be reflected back
$hdr->setId("create-personnel-s2002r5");

$personnelRequestInput->setHeader($hdr);

$personnelBody = new model\PersonnelRequest();

// Required field . Used for
// SMS login in to the UI
// For Braango Enterprise, this is don't care
// unless partner implements UI with SMS login
$personnelBody->setSmsLogin(FALSE);

$personnelBody->setPersonnelName("personnel rep5");

/*
 * This is a user name created while signing this personnel up.
 * Typically this user name can be used to log into the braango UI.
 * However for whitelabel product, it is expected that this will be used
 * for single signon with respect to dealer account on partner system.
 * i.e. it is expected that partner will pass on the same user name that
 * dealer has on its system to give seamless integration experience.
 */
$personnelBody->setUserName("subdealers2002r5");

/*
 * Password will be encrypted with SHA-25 and base64 encoded and stored
 * internally within the braango system. pattern:
 * ^(?=^.{6,10}$)(?=.*\d)(
 * ?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{&quot
 * ;:;'?/>.<,])(?!.*\s).*$
 *
 * Used for single sign on. needs to 6-10 characters with one capital,
 * one numberal and one special character
 */
$personnelBody->setPassword("test1T$");

$personnelBody->setEmail("s2002r3@subdealer2002r5.com");

// If email specified is that for
// CRM email (ADF XML compliant)

$personnelBody->setTypeAdfCrm($typeAdfCRMEmail);

/*
 * Number where dealer's root account can be reached via SMS
 * for leads
 *
 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
 */
$personnelBody->setPhoneNumber('4089763437');

/*
 * Number where dealer's root account can be reached via SMS
 * for leads
 *
 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
 */
$personnelBody->setSmsNumber('4089763437');

// Subscribe to the group
$personnelBody->setGroup('s2002r5g');

// OPTIONAL FIELDS

// List of dealer banners. Braango will
// randomly choose one when sending
// message to dealer via SMS
//
$dealerBanners = array(
    "s2002r5db1"
);
$personnelBody->setDealerBanners($dealerBanners);

// List of client banners. Braango
// will randomly choose one when
// sending dealer messages to client
$clientBanners = array(
    's2002r5cb1'
);

$personnelBody->setClientBanners($clientBanners);

// List of dealer footers. Braango will
// randomly choose one when sending
// message to dealer via SMS
//
$dealerFooters = array(
    's2002r5df1'
);
$personnelBody->setDealerFooters($dealerFooters);

// List of client footers. Braango
// will randomly choose one when
// sending dealer messages to client
$clientFooters = array(
    's2002r5cf1'
);
$personnelBody->setClientFooters($clientFooters);

// List of supervisor banners. Braango
// will randomly choose one when
// sending messages to supervisor
$supervisorBanners = array(
    's2002r5sb1'
);
$personnelBody->setSupervisorBanners($supervisorBanners);

// List of supervisor footers. Braango
// will randomly choose one when
// sending messages to supervisor
$supervisorFooters = array(
    's2002r5sf1'
);
$personnelBody->setSupervisorFooters($supervisorFooters);

$personnelRequestInput->setBody($personnelBody);

try {
    $result = $api_instance->createPersonnel($subdealerid, $personnelRequestInput);
    
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "/n");
            
            $salesPersonId = $rspBdy->getData()->getSalesPersonId();
            
            print_r("SUCCESS : SalespersonID = " . $salesPersonId);
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling PersonnelsApi->createPersonnel: ', $e->getMessage(), PHP_EOL;
}
?>

This api call is used to update personnel for additions. Practically all the fields of the personnel that are necessary for functioning as braango personnel can be updated to add more except for supervisor. Supervisor needs to be updated,created using a seperate API call

Note This call will be used to only add additional fields. To actually delete unwanted fields, please use appropiate sub_resource calls

<?php
use Braango\braangomodel as model;
use Braango\braangomodel\RequestHeader as rhdr;

require_once (__DIR__ . '/../../vendor/autoload.php');

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\PersonnelsApi();

// string | Sub dealer for which this sales person belongs to.
$subdealerid = "subdealers2002";

// string | Sales person ID that was returned when this personnel was created
$salespersonid = "945cddce-6ef6-46e4-ac70-09375cf5165a";

// \Braango\braangomodel\PersonnelUpdateRequestInput |
$personnelUpdateRequestInput = new \Braango\braangomodel\PersonnelUpdateRequestInput();

$typeAdfCRMEmail = FALSE;

/*
 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
 * "account_type": "partner" }
 */
$hdr = new rhdr();

// Set the account type to partner for
// virtual dealer and partner hosted
// accounts
$hdr->setAccountType("partner");

// dealer_api_key returned
// when partner_dealer was created
$hdr->setApiKey("ISNMdzuNiKG7jhl9d9v");

// ID that will be reflected back
$hdr->setId("create-personnel-s2002r2");

$personnelUpdateRequestInput->setHeader($hdr);

$personnelUpdateBody = new model\PersonnelUpdate();

// REQUIRED FIELDS

// Required field . Used for
// SMS login in to the UI
// For Braango Enterprise, this is don't care
// unless partner implements UI with SMS login
$personnelUpdateBody->setSmsLogin(FALSE);

/*
 * Password will be encrypted with SHA-25 and base64 encoded and stored
 * internally within the braango system. pattern:
 * ^(?=^.{6,10}$)(?=.*\d)(
 * ?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{&quot
 * ;:;'?/>.<,])(?!.*\s).*$
 *
 * Used for single sign on. needs to 6-10 characters with one capital,
 * one numberal and one special character
 *
 * Chaning the password for the update call
 *
 */
$personnelUpdateBody->setPassword("test2T$");

$personnelUpdateBody->setEmail("s2002r2@subdealer2002.com");

// If email specified is that for
// CRM email (ADF XML compliant)
$personnelUpdateBody->setTypeAdfCrm($typeAdfCRMEmail);

/*
 * Number where dealer's root account can be reached via SMS
 * for leads
 *
 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
 */
$personnelUpdateBody->setPhoneNumber("4089763434");

/*
 * Number where dealer's root account can be reached via SMS
 * for leads
 *
 * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
 */
$personnelUpdateBody->setSmsNumber('4089763434');

// Subscribe to the group
$personnelUpdateBody->setGroup('s2002g');

// OPTIONAL FIELDS

// List of dealer banners. Braango will
// randomly choose one when sending
// message to dealer via SMS
//
$dealerBanners = array(
    "s2002r2db1updated"
);
$personnelUpdateBody->setDealerBanners($dealerBanners);

// List of client banners. Braango
// will randomly choose one when
// sending dealer messages to client
$clientBanners = array(
    's2002r2cb1updated'
);
$personnelUpdateBody->setClientBanners($clientBanners);

// List of dealer footers. Braango will
// randomly choose one when sending
// message to dealer via SMS
//

$dealerFooters = array(
    's2002r2df1updated'
);
$personnelUpdateBody->setDealerFooters($dealerFooters);

// List of client footers. Braango
// will randomly choose one when
// sending dealer messages to client
$clientFooters = array(
    's2002r2cf1updated'
);
$personnelUpdateBody->setClientFooters($clientFooters);

// List of supervisor banners. Braango
// will randomly choose one when
// sending messages to supervisor
$supervisorBanners = array(
    's2002r2sb1updated'
);
$personnelUpdateBody->setSupervisorBanners($supervisorBanners);

// List of supervisor footers. Braango
// will randomly choose one when
// sending messages to supervisor
$supervisorFooters = array(
    's2002r2sf1updated'
);
$personnelUpdateBody->setSupervisorFooters($supervisorFooters);

$personnelUpdateRequestInput->setBody($personnelUpdateBody);

try {
    $result = $api_instance->updatePersonnel($subdealerid, $salespersonid, $personnelUpdateRequestInput);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $salesPersonId = $rspBdy->getData()->getSalesPersonId();
            
            print_r("SUCCESS : Updated SalespersonID = " . $salesPersonId . "\n");
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling PersonnelsApi->updatePersonnel: ', $e->getMessage(), PHP_EOL;
}
?>

This api call returns the personnel that was created under subDealer represented by subdealerid. Personnel ID needs to be provided

<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to create subDealer
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\PersonnelsApi();

// string | Sub dealer for which this sales person belongs to.
$subdealerid = "subdealers2002";

// string | Sales person ID that was returned when this personnel was created
$salespersonid = "945cddce-6ef6-46e4-ac70-09375cf5165a";

// string | API Key to access this dealer's resources.
// Value was returned when create_account api
// was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    $result = $api_instance->getPersonnel($subdealerid, $salespersonid, $apiKey, $accountType);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $salesPersonId = $rspBdy->getData()->getSalesPersonId();
            
            print_r("SUCCESS : Updated SalespersonID = " . $salesPersonId . "\n");
            print_r("Details = " . $result);
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling PersonnelsApi->getPersonnel: ', $e->getMessage(), PHP_EOL;
}
?>

This api call returns the details of all personnel represented by given sub_dealer

<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code to fetch all personnel given a subDealerId
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\PersonnelsApi();

// string | Sub dealer for which this sales person belongs to.
$subdealerid = "subdealers2002";

// string | API Key to access this dealer's resources.
// Value was returned when create_account api
// was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    $result = $api_instance->getPersonnelsPerSubDealer($subdealerid, $apiKey, $accountType);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
            
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            print_r("Details = " . $result);
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling PersonnelsApi->getPersonnelsPerSubDealer: ', $e->getMessage(), PHP_EOL;
}
?>

This api call returns the details of all personnel for given virtual dealer or partner dealer.

<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code to fetch all personnel for virtual dealer
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\PersonnelsApi();

// string | API Key to access this dealer's resources.
// Value was returned when create_account api
// was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    $result = $api_instance->getAllPersonnelForDealer($apiKey, $accountType);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            print_r("Details = " . $result);
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling PersonnelsApi->getAllPersonnelForDealer: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code to delete personnel details
 *        
 *         Deleting personnel wipes out all the entries from the system
 *         Though user name cannot be deleted for security reasons
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\PersonnelsApi();

// string | Sub dealer for which this sales person belongs to.
$subdealerid = "subdealers2002";

// string | Sales person ID that was returned when this personnel was created
$salespersonid = "aed72631-c968-4362-a9a4-ebe5bef8310b";

// string | API Key to access this dealer's resources.
// Value was returned when create_account api
// was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    
    $result = $api_instance->deletePersonnel($subdealerid, $salespersonid, $apiKey, $accountType);
    
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
           
            $salesPersonId = $rspBdy->getData()
                ->getSalesPersonId();
            
            print_r("SUCCESS : Deleted details of SalespersonID = " . $salesPersonId . "\n");
            print_r("Details = " . $result);
        }
    }
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PersonnelsApi->deletePersonnel: ', $e->getMessage(), PHP_EOL;
}
?>
Braango
CONTACT US
Unified customer engagement platform for inbound and outbound communications
Thank You. We will contact you as soon as possible.
PGlmcmFtZSB3aWR0aD0iNTYwIiBoZWlnaHQ9IjMxNSIgc3JjPSJodHRwczovL3d3dy55b3V0dWJlLmNvbS9lbWJlZC9sMVZqaUxUMUFKdyIgZnJhbWVib3JkZXI9IjAiIGFsbG93ZnVsbHNjcmVlbj48L2lmcmFtZT4=