Build Status Maintainability

A Ruby library that provides access to the Microsoft Dynamics365 Business Central REST API.

Currently targets v1.0 of the API as documented here:


With bundler, add the following to your Gemfile

gem 'business_central'


First, you need to create an instance of the BusinessCentral::Client, which is then passed to one of the API query objects.

The gem currently only supports BasicAuthentication. The API supports both BasicAuth and OAuth2.

Best practice is to store all client login details in environment variables. The gem will automatically look for the following ENV variables, but these can be over-ridden in the options Hash:

client ={
  api_tenant: ENV[BC_TENANT],
  api_username: ENV[BC_USERNAME],
  api_password: ENV[BC_PASSWORD],
  api_version: ENV[BC_API_VERSION],
  api_path: ENV[BC_API_PATH],
  api_company_id: ENV[BC_COMPANY_ID],
  api_host: ENV[BC_HOST]

# These options are used to build the URL to access the Business Central API as
# follows:



# Returns an array of Customers
customers =

# Returns an individual Customer
customer ="CUSTOMER_ID")

# POST a new Customer
data = {
  displayName: "Company Name",
  number: "10000",
  type: "Company",

customer =

# Displays "Company Name"
puts customer.displayName