public function InstapageCmsPluginSubaccountModel::getAccountBoundSubAccounts in Instapage plugin 8.3
Same name and namespace in other branches
- 7.3 core/models/InstapageCmsPluginSubaccountModel.php \InstapageCmsPluginSubaccountModel::getAccountBoundSubAccounts()
Gets the list of subaccounts of currently logged in user.
Parameters
string $format Format for the response. Default: 'json'.:
Return value
(string|array) List of subaccounts as a JSON string or an array.
1 call to InstapageCmsPluginSubaccountModel::getAccountBoundSubAccounts()
- InstapageCmsPluginSubaccountModel::disconnectAccountBoundSubaccounts in core/
models/ InstapageCmsPluginSubaccountModel.php - Disconnects all subaccount bound to an account. User has to be looged in via email and password.
File
- core/
models/ InstapageCmsPluginSubaccountModel.php, line 76
Class
- InstapageCmsPluginSubaccountModel
- Class responsible for managing the subaccounts in Instapage app.
Code
public function getAccountBoundSubAccounts($format = 'json') {
$api = InstapageCmsPluginAPIModel::getInstance();
$tokens = $this
->getAccountBoundTokens();
$subAccounts = array();
if (is_array($tokens) && count($tokens)) {
$headers = array(
'accountkeys' => InstapageCmsPluginHelper::getAuthHeader($tokens),
);
$response = json_decode($api
->apiCall('page/get-sub-accounts-list', null, $headers));
$subAccounts = isset($response->data) ? $response->data : null;
}
if ($format == 'json') {
echo json_encode((object) array(
'status' => 'OK',
'data' => $subAccounts,
));
}
else {
return $subAccounts;
}
}