demellor | Posts: 46

subaccount access 11.35 sandbox

0 votes

Does anyone have a .NET c# sample code for the subaccount calls?


Duo_Liang | Posts: 3776

Reply to: subaccount access 11.35 sandbox

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.

SubAccount subAccount = SubAccountBuilder.NewSubAccount()

                                                                     .WithName(NAME)

                                                                     .WithParentAccountId(PARENT_ACCOUNT_ID)

                                                                     .WithLanguage(LANGUAGE)

                                                                    .WithTimezoneId(TIMEZONE_ID)

                                                                    .Build();

 

Duo


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off