Skip to content

uptick/pybusinesscentral

Repository files navigation

pybusinesscentral

(v2.0) Business Central Standard APIs

PyPI version

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import pybusinesscentral

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import pybusinesscentral

Getting Started

Please follow the installation procedure and then run the following:

import time
import pybusinesscentral
from pprint import pprint
from pybusinesscentral.api import account_api
from pybusinesscentral.model.account import Account
from pybusinesscentral.model.inline_response2005 import InlineResponse2005
# Defining the host is optional and defaults to https://api.businesscentral.dynamics.com/v2.0/sandbox/api/v2.0
# See configuration.py for a list of all supported configuration parameters.
configuration = pybusinesscentral.Configuration(
    host = "https://api.businesscentral.dynamics.com/v2.0/sandbox/api/v2.0"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure OAuth2 access token for authorization: oAuth
configuration = pybusinesscentral.Configuration(
    host = "https://api.businesscentral.dynamics.com/v2.0/sandbox/api/v2.0"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'


# Enter a context with an instance of the API client
with pybusinesscentral.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = account_api.AccountApi(api_client)
    company_id = "company_id_example" # str | (v1.0) id for company
account_id = "account_id_example" # str | (v1.0) id for account
select = [
        "id",
    ] # [str] | (v1.0) Selected properties to be retrieved (optional)

    try:
        # Retrieve the properties and relationships of an object of type account for Dynamics 365 Business Central.
        api_response = api_instance.get_account(company_id, account_id, select=select)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling AccountApi->get_account: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.businesscentral.dynamics.com/v2.0/sandbox/api/v2.0

Class Method HTTP request Description
AccountApi get_account GET /companies({company_id})/accounts({account_id}) Retrieve the properties and relationships of an object of type account for Dynamics 365 Business Central.
AccountApi list_accounts GET /companies({company_id})/accounts Returns a list of accounts
CompanyApi get_company GET /companies({company_id}) Retrieve the properties and relationships of an object of type company for Dynamics 365 Business Central.
CompanyApi list_companies GET /companies Returns a list of companies
CustomerApi delete_customer DELETE /companies({company_id})/customers({customer_id}) Deletes an object of type customer in Dynamics 365 Business Central
CustomerApi get_customer GET /companies({company_id})/customers({customer_id}) Retrieve the properties and relationships of an object of type customer for Dynamics 365 Business Central.
CustomerApi list_customers GET /companies({company_id})/customers Returns a list of customers
CustomerApi patch_customer PATCH /companies({company_id})/customers({customer_id}) Updates an object of type customer in Dynamics 365 Business Central
CustomerApi post_customer POST /companies({company_id})/customers Creates an object of type customer in Dynamics 365 Business Central
DimensionApi get_dimension GET /companies({company_id})/dimensions({dimension_id}) Retrieve the properties and relationships of an object of type dimension for Dynamics 365 Business Central.
DimensionApi list_dimensions GET /companies({company_id})/dimensions Returns a list of dimensions
DimensionSetLineApi get_dimension_set_lines_for_sales_invoice_line GET /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines({salesInvoiceLine_id})/dimensionSetLines Retrieve the properties and relationships of the list of dimensionSetLines for a salesInvoiceLine.
DimensionSetLineApi post_dimension_set_line POST /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines({salesInvoiceLine_id})/dimensionSetLines Creates an object of type dimensionSetLine in Dynamics 365 Business Central
PaymentTermApi delete_payment_term DELETE /companies({company_id})/paymentTerms({paymentTerm_id}) Deletes an object of type paymentTerm in Dynamics 365 Business Central
PaymentTermApi get_payment_term GET /companies({company_id})/paymentTerms({paymentTerm_id}) Retrieve the properties and relationships of an object of type paymentTerm for Dynamics 365 Business Central.
PaymentTermApi list_payment_terms GET /companies({company_id})/paymentTerms Returns a list of paymentTerms
PaymentTermApi patch_payment_term PATCH /companies({company_id})/paymentTerms({paymentTerm_id}) Updates an object of type paymentTerm in Dynamics 365 Business Central
PaymentTermApi post_payment_term POST /companies({company_id})/paymentTerms Creates an object of type paymentTerm in Dynamics 365 Business Central
PurchaseInvoiceApi delete_purchase_invoice DELETE /companies({company_id})/purchaseInvoices({purchaseInvoice_id}) Deletes an object of type purchaseInvoice in Dynamics 365 Business Central
PurchaseInvoiceApi get_purchase_invoice GET /companies({company_id})/purchaseInvoices({purchaseInvoice_id}) Retrieve the properties and relationships of an object of type purchaseInvoice for Dynamics 365 Business Central.
PurchaseInvoiceApi list_purchase_invoices GET /companies({company_id})/purchaseInvoices Returns a list of purchaseInvoices
PurchaseInvoiceApi patch_purchase_invoice PATCH /companies({company_id})/purchaseInvoices({purchaseInvoice_id}) Updates an object of type purchaseInvoice in Dynamics 365 Business Central
PurchaseInvoiceApi post_purchase_invoice POST /companies({company_id})/purchaseInvoices Creates an object of type purchaseInvoice in Dynamics 365 Business Central
SalesInvoiceApi delete_sales_invoice DELETE /companies({company_id})/salesInvoices({salesInvoice_id}) Deletes an object of type salesInvoice in Dynamics 365 Business Central
SalesInvoiceApi get_sales_invoice GET /companies({company_id})/salesInvoices({salesInvoice_id}) Retrieve the properties and relationships of an object of type salesInvoice for Dynamics 365 Business Central.
SalesInvoiceApi list_sales_invoices GET /companies({company_id})/salesInvoices Returns a list of salesInvoices
SalesInvoiceApi patch_sales_invoice PATCH /companies({company_id})/salesInvoices({salesInvoice_id}) Updates an object of type salesInvoice in Dynamics 365 Business Central
SalesInvoiceApi post_sales_invoice POST /companies({company_id})/salesInvoices Creates an object of type salesInvoice in Dynamics 365 Business Central
SalesInvoiceLineApi delete_sales_invoice_line_for_sales_invoice DELETE /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines('{salesInvoiceLine_id}') Deletes an object of type salesInvoiceLine in Dynamics 365 Business Central
SalesInvoiceLineApi get_sales_invoice_line_for_sales_invoice GET /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines('{salesInvoiceLine_id}') Retrieve the properties and relationships of an object of type salesInvoiceLine for Dynamics 365 Business Central.
SalesInvoiceLineApi list_sales_invoice_lines GET /companies({company_id})/salesInvoiceLines Returns a list of salesInvoiceLines
SalesInvoiceLineApi list_sales_invoice_lines_for_sales_invoice GET /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines Returns a list of salesInvoiceLines
SalesInvoiceLineApi patch_sales_invoice_line_for_sales_invoice PATCH /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines('{salesInvoiceLine_id}') Updates an object of type salesInvoiceLine in Dynamics 365 Business Central
SalesInvoiceLineApi post_sales_invoice_line POST /companies({company_id})/salesInvoiceLines Creates an object of type salesInvoiceLine in Dynamics 365 Business Central
SalesInvoiceLineApi post_sales_invoice_line_for_sales_invoice POST /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines Creates an object of type salesInvoiceLine in Dynamics 365 Business Central
VendorApi delete_vendor DELETE /companies({company_id})/vendors({vendor_id}) Deletes an object of type vendor in Dynamics 365 Business Central
VendorApi get_vendor GET /companies({company_id})/vendors({vendor_id}) Retrieve the properties and relationships of an object of type vendor for Dynamics 365 Business Central.
VendorApi list_vendors GET /companies({company_id})/vendors Returns a list of vendors
VendorApi patch_vendor PATCH /companies({company_id})/vendors({vendor_id}) Updates an object of type vendor in Dynamics 365 Business Central
VendorApi post_vendor POST /companies({company_id})/vendors Creates an object of type vendor in Dynamics 365 Business Central

Documentation For Models

Documentation For Authorization

oAuth

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in pybusinesscentral.apis and pybusinesscentral.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from pybusinesscentral.api.default_api import DefaultApi
  • from pybusinesscentral.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import pybusinesscentral
from pybusinesscentral.apis import *
from pybusinesscentral.models import *