The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.
This C# SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.3.0
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
For more information, please visit https://support.lob.com/
First, you will need to first create an account at Lob.com and obtain your Test and Live API Keys.
Once you have created an account, you can access your API Keys from the Settings Panel.
$ dotnet add package lob.dotnet
To use the API client with a HTTP proxy, setup a System.Net.WebProxy
Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
using System.Collections.Generic;
using System.Diagnostics;
using lob.dotnet.Api;
using lob.dotnet.Client;
using lob.dotnet.Model;
namespace Example
{
public class Example
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.lob.com/v1";
// Configure HTTP basic authorization: basicAuth
config.Username = "<<YOUR_LOB_API_KEY>>";
var apiInstance = new AddressesApi(config);
var addressEditable = new AddressEditable();
try
{
// create
Address result = apiInstance.create(addressEditable);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AddressesApi.create: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
The full and comprehensive documentation of Lob's APIs is available here.
$ dotnet test --filter Category=Unit
Integration tests run against a live deployment of the Lob API and require multiple valid API keys with access to specific features. As such, it is not expected that these tests will pass for every user in every environment.
To run integration tests:
$ LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>> dotnet test --filter Category=Integration
Run this the first time:
$ echo "LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>>" > LOCAL.env
Then, to run the integration tests:
$ env $(cat LOCAL.env) dotnet test --filter Category=Integration
- Type: HTTP basic authentication