<?phprequire_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 youBraango\Configuration::getDefaultConfiguration()->setApiKey('auth_token','ISNWF0P30WM0CMK');$api_instance=newBraango\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;}?>
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.