DEPRECATED

The persons API is deprecated in favor of the Core API see hereopen in new window

Persons API SDK Dotnet

This is the official dotnet SDK for the persons API. The SDK supports Linq expressions to easily query person data.

Install

Package is availible on Nuget

dotnet add package BccCode.Persons.Api.Client
dotnet add package BccCode.Persons.Api.Contracts

Configure

  1. Import the client package

    using BccCode.Persons.Api.Client
    
  2. Create the client

    var options = new PersonsApiClientOptions{
        ClientId = "CLIENT_ID",
        ClientSecret = "CLIENT_SECRET",
        ApiBasePath = "API_ORIGIN",
        Audience = "API_AUDIENCE",
        Authority = "IDENTITY_SERVER_ORIGIN",
        Scope = $"{PersonsApiScope.ReadName} {PersonsApiScope.ReadGender}"
    };
    var client = new PersonsApiClient(options);
    

Use the client

Get a single person

var person = await client.getPersonAsync(1234)

Get all the persons

var allPersons = await client.getPersonsAsync()

Get filtered persons

var personsUnderTwoYearsOld = await client.getQueryable().Where(p => p.Age < 2).ToListAsync();