setApiKey('auth_token', 'ISNWF0P30WM0CMK'); $api_instance = new Braango\braangoapi\SupervisorsApi(); // string | id of _sub_account_ $subdealerid = "subdealers2002"; // string | id of salesperson $salespersonid = "aed72631-c968-4362-a9a4-ebe5bef8310b"; // string | group $group = "Test Group"; // Braango\braangomodel\SupervisorInput | $supervisorInput = new \Braango\braangomodel\SupervisorInput(); /* * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value", * "account_type": "partner" } */ $hrd = new rhdr(); // dealer_api_key returned // when partner_dealer was created $hrd->setApiKey("ISNMdzuNiKG7jhl9d9v"); // Set the account type to partner for // virtual dealer and partner hosted // accounts $hrd->setAccountType("partner"); // ID that will be reflected back $hrd->setId("group-create-s2002r4"); $supervisorInput->setHeader($hrd); $supervisorInputBody = new model\SupervisorInputBody(); $supervisorPersonnelId = "945cddce-6ef6-46e4-ac70-09375cf5165a"; $supervisorInputBody->setSupervisor($supervisorPersonnelId); $supervisorInput->setBody($supervisorInputBody); try { $result = $api_instance->createSupervisor($subdealerid, $salespersonid, $group, $supervisorInput); 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"); $supervisorOutputBodyData = $rspBdy->getData(); print_r("Group List : " . $supervisorOutputBodyData); } } } catch (Exception $e) { echo 'Exception when calling SupervisorsApi->createSupervisor: ', $e->getMessage(), PHP_EOL; } ?>