Does anyone have a .NET c# sample code for the subaccount calls?
July 19Created
October 4Last Updated
2 years agoLast Reply
1Replies
38Views
2Users
0Likes
0Links
Duo_Liang | Posts: 3776
Reply to: subaccount access 11.35 sandbox
Tuesday, October 4, 2022 at 02:18pm
0
votes
Hi demellor,
Below are the current available APIs regarding to subaccount:
GET /api/account/accessibleaccounts //get accessible accounts of a particular sender, by using sender's API credential
GET /api/account/subaccounts //get a list of the subaccounts under your main account
POST /api/account/subaccounts //create a subaccount
PUT /api/account/subaccounts/{accountId} //update a subaccount
So essentially this is the scope of the SDK function, these four APIs are implemented in the "AccountService" class, let check their function signature:
public IList<AccessibleAccountResponse> getAccessibleAccounts() //get accessible accounts of a particular sender, by using sender's API credential
public IList<Account> getSubAccounts() //get a list of the subaccounts under your main account
public Account createSubAccount(SubAccount subAccount) //create a subaccount
public void updateSubAccount(SubAccount subAccount, String accountId) //update a subaccount
And a sample code how you can build a SubAccount object.
Reply to: subaccount access 11.35 sandbox
Tuesday, October 4, 2022 at 02:18pmHi demellor,
Below are the current available APIs regarding to subaccount:
GET /api/account/accessibleaccounts //get accessible accounts of a particular sender, by using sender's API credential
GET /api/account/subaccounts //get a list of the subaccounts under your main account
POST /api/account/subaccounts //create a subaccount
PUT /api/account/subaccounts/{accountId} //update a subaccount
So essentially this is the scope of the SDK function, these four APIs are implemented in the "AccountService" class, let check their function signature:
public IList<AccessibleAccountResponse> getAccessibleAccounts() //get accessible accounts of a particular sender, by using sender's API credential
public IList<Account> getSubAccounts() //get a list of the subaccounts under your main account
public Account createSubAccount(SubAccount subAccount) //create a subaccount
public void updateSubAccount(SubAccount subAccount, String accountId) //update a subaccount
And a sample code how you can build a SubAccount object.
SubAccount subAccount = SubAccountBuilder.NewSubAccount()
.WithName(NAME)
.WithParentAccountId(PARENT_ACCOUNT_ID)
.WithLanguage(LANGUAGE)
.WithTimezoneId(TIMEZONE_ID)
.Build();
Duo