Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

One of the most basic things you probably want to accomplish using the BFS API is to create a new account in BFS for a certain user. In this blog post I will demonstrate how to accomplish this given a few circumstances.

In order to use CreateAccounts you need to provide three inputs:

  • Owner (this is the GUID, unique ID of the Legal Entity who should own the account)
  • AccountTypeKey (this is a unique string value representing a certain account type)
  • BaseCurrencyCode (this tells BFS which currency to use to calculate performance for the account among other things)

Obviously the first problem to solve is getting the unique ID for the Legal Entity. Unique ID's in BFS are called BrickId's. At the time of this writing there is no way to view the BrickId for a LegalEntity in BFS (this is being added shortly) so the only way to do this is via the API method GetPersons.

In my instance of BFS I have a default user with username bnuser and I would like to get the BrickId of this user via GetPersons, see code below.

C# - Get legal entity details using username as input
var client = new BFSServiceReference.bfsapiSoapClient();
var credentials = new BFSServiceReference.Credentials()
{
    UserName = bfsusername, //Username of administrative user in your instance of BFS
    Password = bfspassword, //Password of the administrative user in your instance of BFS
};
var persons = client.GetPersons(new BFSServiceReference.GetPersonRequest()
{
    Credentials = credentials,
    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS  
 
    Args = new BFSServiceReference.GetPersonArgs()
    {
      UserName  = "bnuser",
    },
   
    Fields = new BFSServiceReference.GetPersonFields()
    {
        BrickId = true,
        UserName = true,
        FirstName = true,
        LastName = true,
    },
});
foreach (var c in persons.Result)
{
    Console.WriteLine(c.BrickId + "," + c.FirstName + "," + c.LastName);
}
  • No labels