demellor

subaccount access 11.35 sandbox

0 votes

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

Richard DeMello


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

 

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: subaccount access 11.35 sandbox

0 votes

Thank you that's helpful.  I'm using the following type of c# code to access the web service.

 

using Silanis.ESL.SDK;
using Silanis.ESL.SDK.Builder;
using Silanis.ESL.SDK.Internal;
using Newtonsoft.Json.Linq;

 

               EslClient eslClient = new EslClient(Program.apiKey, Program.apiUrl);
                UsageReport report = eslClient.ReportService.DownloadUsageReport(from, to);
 

 

I assumed based on the subaccount documentation i'd do something like eslClient.AccountService. <the subaccount methods/functions>

 

I wonder since obviously they are new to the wsdl do I need to do something so Visual Studio sees the new functions?

Richard DeMello


Reply to: subaccount access 11.35 sandbox

0 votes

Hi demellor,

 

Thanks for bringing it up to us! Since SDK version 11.33, we've embraced an upgrade that the .NET SDK now supports both .NET framework and Core 2.0. The project has been moved to a new repository:

https://github.com/OneSpan/oss.sdk.net

The way how you download the latest SDK also has been changed - now we host the .NET SDK on Nuget again:

https://www.nuget.org/packages/OneSpanSign.Sdk/

The new SDK has rebranded some of the namespace and class names, for example, the EslClient class now called OssClient. Check the READ.ME of the repository or below:

To migrate from "esl.sdk.net" to "oss.sdk.net" see below changes:

  • Namespace has changed from "Silanis.ESL.SDK" to "OneSpanSign.Sdk"
  • Namespace has changed from "Silanis.ESL.API" to "OneSpanSign.API"
  • Class has been renamed from "EslClient" to "OssClient"
  • Class has been renamed from "EslException" to "OssException"
  • Class has been renamed from "EslServerException" to "OssServerException"
  • Class has been renamed from "EslEnumeration" to "OssEnumeration"

 

The Subaccount functions were only introduced at the new .NET SDK (submission history on Git), therefore, although the code migration could take some extra efforts, you may still decide to upgrade SDK in order to leverage the latest features.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: subaccount access 11.35 sandbox

0 votes

Thank you - I'll spend some time in the next week or so and get it converted!

Richard DeMello


Reply to: subaccount access 11.35 sandbox

0 votes

Thank you for the help.  I have converted my sample and also work with Michael Williams on a couple approaches we are testing to get the user information I'm after.

Richard DeMello


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