# pybusinesscentral
(v2.0) Business Central Standard APIs

[![PyPI version](https://badge.fury.io/py/pybusinesscentral.svg)](https://pypi.org/project/pybusinesscentral)

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 2.0.0
- Package version: 2.1.0
- Generator version: 7.13.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python 3.9+

## Installation & Usage
### pip install

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

```sh
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:
```python
import pybusinesscentral
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import pybusinesscentral
```

### Tests

Execute `pytest` to run the tests.

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

import pybusinesscentral
from pybusinesscentral.rest import ApiException
from pprint import pprint

# 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.

configuration.access_token = os.environ["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 = pybusinesscentral.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 = ['select_example'] # List[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)
        print("The response of AccountApi->get_account:\n")
        pprint(api_response)
    except 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**](docs/AccountApi.md#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**](docs/AccountApi.md#list_accounts) | **GET** /companies({company_id})/accounts | Returns a list of accounts
*CompanyApi* | [**get_company**](docs/CompanyApi.md#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**](docs/CompanyApi.md#list_companies) | **GET** /companies | Returns a list of companies
*CustomerApi* | [**delete_customer**](docs/CustomerApi.md#delete_customer) | **DELETE** /companies({company_id})/customers({customer_id}) | Deletes an object of type customer in Dynamics 365 Business Central
*CustomerApi* | [**get_customer**](docs/CustomerApi.md#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**](docs/CustomerApi.md#list_customers) | **GET** /companies({company_id})/customers | Returns a list of customers
*CustomerApi* | [**patch_customer**](docs/CustomerApi.md#patch_customer) | **PATCH** /companies({company_id})/customers({customer_id}) | Updates an object of type customer in Dynamics 365 Business Central
*CustomerApi* | [**post_customer**](docs/CustomerApi.md#post_customer) | **POST** /companies({company_id})/customers | Creates an object of type customer in Dynamics 365 Business Central
*DimensionApi* | [**get_dimension**](docs/DimensionApi.md#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**](docs/DimensionApi.md#list_dimensions) | **GET** /companies({company_id})/dimensions | Returns a list of dimensions
*DimensionSetLineApi* | [**get_dimension_set_lines_for_sales_invoice_line**](docs/DimensionSetLineApi.md#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**](docs/DimensionSetLineApi.md#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**](docs/PaymentTermApi.md#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**](docs/PaymentTermApi.md#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**](docs/PaymentTermApi.md#list_payment_terms) | **GET** /companies({company_id})/paymentTerms | Returns a list of paymentTerms
*PaymentTermApi* | [**patch_payment_term**](docs/PaymentTermApi.md#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**](docs/PaymentTermApi.md#post_payment_term) | **POST** /companies({company_id})/paymentTerms | Creates an object of type paymentTerm in Dynamics 365 Business Central
*PurchaseInvoiceApi* | [**delete_purchase_invoice**](docs/PurchaseInvoiceApi.md#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**](docs/PurchaseInvoiceApi.md#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**](docs/PurchaseInvoiceApi.md#list_purchase_invoices) | **GET** /companies({company_id})/purchaseInvoices | Returns a list of purchaseInvoices
*PurchaseInvoiceApi* | [**patch_purchase_invoice**](docs/PurchaseInvoiceApi.md#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**](docs/PurchaseInvoiceApi.md#post_purchase_invoice) | **POST** /companies({company_id})/purchaseInvoices | Creates an object of type purchaseInvoice in Dynamics 365 Business Central
*SalesCreditMemoApi* | [**delete_sales_credit_memo**](docs/SalesCreditMemoApi.md#delete_sales_credit_memo) | **DELETE** /companies({company_id})/salesCreditMemos({salesCreditMemo_id}) | Deletes an object of type salesCreditMemo in Dynamics 365 Business Central
*SalesCreditMemoApi* | [**get_sales_credit_memo**](docs/SalesCreditMemoApi.md#get_sales_credit_memo) | **GET** /companies({company_id})/salesCreditMemos({salesCreditMemo_id}) | Retrieve the properties and relationships of an object of type salesCreditMemo for Dynamics 365 Business Central.
*SalesCreditMemoApi* | [**list_sales_credit_memos**](docs/SalesCreditMemoApi.md#list_sales_credit_memos) | **GET** /companies({company_id})/salesCreditMemos | Returns a list of salesCreditMemos
*SalesCreditMemoApi* | [**patch_sales_credit_memo**](docs/SalesCreditMemoApi.md#patch_sales_credit_memo) | **PATCH** /companies({company_id})/salesCreditMemos({salesCreditMemo_id}) | Updates an object of type salesCreditMemo in Dynamics 365 Business Central
*SalesCreditMemoApi* | [**post_action_sales_credit_memos**](docs/SalesCreditMemoApi.md#post_action_sales_credit_memos) | **POST** /companies({company_id})/salesCreditMemos({salesCreditMemo_id})/Microsoft.NAV.post | Performs the post action for salesCreditMemos entity
*SalesCreditMemoApi* | [**post_and_send_action_sales_credit_memos**](docs/SalesCreditMemoApi.md#post_and_send_action_sales_credit_memos) | **POST** /companies({company_id})/salesCreditMemos({salesCreditMemo_id}) | Performs the postAndSend action for salesCreditMemos entity
*SalesCreditMemoApi* | [**post_sales_credit_memo**](docs/SalesCreditMemoApi.md#post_sales_credit_memo) | **POST** /companies({company_id})/salesCreditMemos | Creates an object of type salesCreditMemo in Dynamics 365 Business Central
*SalesCreditMemoLineApi* | [**delete_sales_credit_memo_line_for_sales_credit_memo**](docs/SalesCreditMemoLineApi.md#delete_sales_credit_memo_line_for_sales_credit_memo) | **DELETE** /companies({company_id})/salesCreditMemos({salesCreditMemo_id})/salesCreditMemoLines(&#39;{salesCreditMemoLine_id}&#39;) | Deletes an object of type salesCreditMemoLine in Dynamics 365 Business Central
*SalesCreditMemoLineApi* | [**get_sales_credit_memo_line_for_sales_credit_memo**](docs/SalesCreditMemoLineApi.md#get_sales_credit_memo_line_for_sales_credit_memo) | **GET** /companies({company_id})/salesCreditMemos({salesCreditMemo_id})/salesCreditMemoLines(&#39;{salesCreditMemoLine_id}&#39;) | Retrieve the properties and relationships of an object of type salesCreditMemoLine for Dynamics 365 Business Central.
*SalesCreditMemoLineApi* | [**list_sales_credit_memo_lines**](docs/SalesCreditMemoLineApi.md#list_sales_credit_memo_lines) | **GET** /companies({company_id})/salesCreditMemoLines | Returns a list of salesCreditMemoLines
*SalesCreditMemoLineApi* | [**list_sales_credit_memo_lines_for_sales_credit_memo**](docs/SalesCreditMemoLineApi.md#list_sales_credit_memo_lines_for_sales_credit_memo) | **GET** /companies({company_id})/salesCreditMemos({salesCreditMemo_id})/salesCreditMemoLines | Returns a list of salesCreditMemoLines
*SalesCreditMemoLineApi* | [**patch_sales_credit_memo_line_for_sales_credit_memo**](docs/SalesCreditMemoLineApi.md#patch_sales_credit_memo_line_for_sales_credit_memo) | **PATCH** /companies({company_id})/salesCreditMemos({salesCreditMemo_id})/salesCreditMemoLines(&#39;{salesCreditMemoLine_id}&#39;) | Updates an object of type salesCreditMemoLine in Dynamics 365 Business Central
*SalesCreditMemoLineApi* | [**post_sales_credit_memo_line**](docs/SalesCreditMemoLineApi.md#post_sales_credit_memo_line) | **POST** /companies({company_id})/salesCreditMemoLines | Creates an object of type salesCreditMemoLine in Dynamics 365 Business Central
*SalesCreditMemoLineApi* | [**post_sales_credit_memo_line_for_sales_credit_memo**](docs/SalesCreditMemoLineApi.md#post_sales_credit_memo_line_for_sales_credit_memo) | **POST** /companies({company_id})/salesCreditMemos({salesCreditMemo_id})/salesCreditMemoLines | Creates an object of type salesCreditMemoLine in Dynamics 365 Business Central
*SalesInvoiceApi* | [**delete_sales_invoice**](docs/SalesInvoiceApi.md#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**](docs/SalesInvoiceApi.md#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**](docs/SalesInvoiceApi.md#list_sales_invoices) | **GET** /companies({company_id})/salesInvoices | Returns a list of salesInvoices
*SalesInvoiceApi* | [**patch_sales_invoice**](docs/SalesInvoiceApi.md#patch_sales_invoice) | **PATCH** /companies({company_id})/salesInvoices({salesInvoice_id}) | Updates an object of type salesInvoice in Dynamics 365 Business Central
*SalesInvoiceApi* | [**post_action_sales_invoices**](docs/SalesInvoiceApi.md#post_action_sales_invoices) | **POST** /companies({company_id})/salesInvoices({salesInvoice_id})/Microsoft.NAV.post | Performs the post action for salesInvoices entity
*SalesInvoiceApi* | [**post_sales_invoice**](docs/SalesInvoiceApi.md#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**](docs/SalesInvoiceLineApi.md#delete_sales_invoice_line_for_sales_invoice) | **DELETE** /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines(&#39;{salesInvoiceLine_id}&#39;) | Deletes an object of type salesInvoiceLine in Dynamics 365 Business Central
*SalesInvoiceLineApi* | [**get_sales_invoice_line_for_sales_invoice**](docs/SalesInvoiceLineApi.md#get_sales_invoice_line_for_sales_invoice) | **GET** /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines(&#39;{salesInvoiceLine_id}&#39;) | Retrieve the properties and relationships of an object of type salesInvoiceLine for Dynamics 365 Business Central.
*SalesInvoiceLineApi* | [**list_sales_invoice_lines**](docs/SalesInvoiceLineApi.md#list_sales_invoice_lines) | **GET** /companies({company_id})/salesInvoiceLines | Returns a list of salesInvoiceLines
*SalesInvoiceLineApi* | [**list_sales_invoice_lines_for_sales_invoice**](docs/SalesInvoiceLineApi.md#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**](docs/SalesInvoiceLineApi.md#patch_sales_invoice_line_for_sales_invoice) | **PATCH** /companies({company_id})/salesInvoices({salesInvoice_id})/salesInvoiceLines(&#39;{salesInvoiceLine_id}&#39;) | Updates an object of type salesInvoiceLine in Dynamics 365 Business Central
*SalesInvoiceLineApi* | [**post_sales_invoice_line**](docs/SalesInvoiceLineApi.md#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**](docs/SalesInvoiceLineApi.md#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**](docs/VendorApi.md#delete_vendor) | **DELETE** /companies({company_id})/vendors({vendor_id}) | Deletes an object of type vendor in Dynamics 365 Business Central
*VendorApi* | [**get_vendor**](docs/VendorApi.md#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**](docs/VendorApi.md#list_vendors) | **GET** /companies({company_id})/vendors | Returns a list of vendors
*VendorApi* | [**patch_vendor**](docs/VendorApi.md#patch_vendor) | **PATCH** /companies({company_id})/vendors({vendor_id}) | Updates an object of type vendor in Dynamics 365 Business Central
*VendorApi* | [**post_vendor**](docs/VendorApi.md#post_vendor) | **POST** /companies({company_id})/vendors | Creates an object of type vendor in Dynamics 365 Business Central


## Documentation For Models

 - [Account](docs/Account.md)
 - [AgedAccountsPayable](docs/AgedAccountsPayable.md)
 - [AgedAccountsReceivable](docs/AgedAccountsReceivable.md)
 - [Attachments](docs/Attachments.md)
 - [BalanceSheet](docs/BalanceSheet.md)
 - [BankAccount](docs/BankAccount.md)
 - [CashFlowStatement](docs/CashFlowStatement.md)
 - [Company](docs/Company.md)
 - [CompanyInformation](docs/CompanyInformation.md)
 - [CountryRegion](docs/CountryRegion.md)
 - [Currency](docs/Currency.md)
 - [Customer](docs/Customer.md)
 - [CustomerFinancialDetail](docs/CustomerFinancialDetail.md)
 - [CustomerPayment](docs/CustomerPayment.md)
 - [CustomerPaymentJournal](docs/CustomerPaymentJournal.md)
 - [CustomerSale](docs/CustomerSale.md)
 - [DefaultDimensions](docs/DefaultDimensions.md)
 - [Dimension](docs/Dimension.md)
 - [DimensionLine](docs/DimensionLine.md)
 - [DimensionSetLine](docs/DimensionSetLine.md)
 - [DimensionValue](docs/DimensionValue.md)
 - [Dimensiontype](docs/Dimensiontype.md)
 - [Documentlineobjectdetailstype](docs/Documentlineobjectdetailstype.md)
 - [Employee](docs/Employee.md)
 - [GeneralLedgerEntry](docs/GeneralLedgerEntry.md)
 - [GeneralLedgerEntryAttachments](docs/GeneralLedgerEntryAttachments.md)
 - [GeneralLedgerEntryDimensionsInner](docs/GeneralLedgerEntryDimensionsInner.md)
 - [IncomeStatement](docs/IncomeStatement.md)
 - [Item](docs/Item.md)
 - [ItemCategory](docs/ItemCategory.md)
 - [Itemunitofmeasureconversiontype](docs/Itemunitofmeasureconversiontype.md)
 - [Journal](docs/Journal.md)
 - [JournalLine](docs/JournalLine.md)
 - [ListAccounts200Response](docs/ListAccounts200Response.md)
 - [ListCompanies200Response](docs/ListCompanies200Response.md)
 - [ListCustomers200Response](docs/ListCustomers200Response.md)
 - [ListDimensions200Response](docs/ListDimensions200Response.md)
 - [ListPaymentTerms200Response](docs/ListPaymentTerms200Response.md)
 - [ListPurchaseInvoices200Response](docs/ListPurchaseInvoices200Response.md)
 - [ListSalesCreditMemoLinesForSalesCreditMemo200Response](docs/ListSalesCreditMemoLinesForSalesCreditMemo200Response.md)
 - [ListSalesCreditMemos200Response](docs/ListSalesCreditMemos200Response.md)
 - [ListSalesInvoiceLinesForSalesInvoice200Response](docs/ListSalesInvoiceLinesForSalesInvoice200Response.md)
 - [ListSalesInvoices200Response](docs/ListSalesInvoices200Response.md)
 - [ListVendors200Response](docs/ListVendors200Response.md)
 - [PaymentMethod](docs/PaymentMethod.md)
 - [PaymentTerm](docs/PaymentTerm.md)
 - [PdfDocument](docs/PdfDocument.md)
 - [Picture](docs/Picture.md)
 - [PostCustomerRequest](docs/PostCustomerRequest.md)
 - [PostDimensionSetLineRequest](docs/PostDimensionSetLineRequest.md)
 - [PostPaymentTermRequest](docs/PostPaymentTermRequest.md)
 - [PostPurchaseInvoiceRequest](docs/PostPurchaseInvoiceRequest.md)
 - [PostSalesCreditMemoLineForSalesCreditMemoRequest](docs/PostSalesCreditMemoLineForSalesCreditMemoRequest.md)
 - [PostSalesCreditMemoRequest](docs/PostSalesCreditMemoRequest.md)
 - [PostSalesInvoiceLineForSalesInvoiceRequest](docs/PostSalesInvoiceLineForSalesInvoiceRequest.md)
 - [PostSalesInvoiceRequest](docs/PostSalesInvoiceRequest.md)
 - [PostVendorRequest](docs/PostVendorRequest.md)
 - [Postaladdresstype](docs/Postaladdresstype.md)
 - [Project](docs/Project.md)
 - [PurchaseInvoice](docs/PurchaseInvoice.md)
 - [PurchaseInvoiceLine](docs/PurchaseInvoiceLine.md)
 - [RetainedEarningsStatement](docs/RetainedEarningsStatement.md)
 - [SalesCreditMemo](docs/SalesCreditMemo.md)
 - [SalesCreditMemoLine](docs/SalesCreditMemoLine.md)
 - [SalesInvoice](docs/SalesInvoice.md)
 - [SalesInvoiceLine](docs/SalesInvoiceLine.md)
 - [SalesOrder](docs/SalesOrder.md)
 - [SalesOrderLine](docs/SalesOrderLine.md)
 - [SalesQuote](docs/SalesQuote.md)
 - [SalesQuoteLine](docs/SalesQuoteLine.md)
 - [ShipmentMethod](docs/ShipmentMethod.md)
 - [TaxArea](docs/TaxArea.md)
 - [TaxGroup](docs/TaxGroup.md)
 - [TimeRegistrationEntry](docs/TimeRegistrationEntry.md)
 - [TrialBalance](docs/TrialBalance.md)
 - [UnitOfMeasure](docs/UnitOfMeasure.md)
 - [Unitofmeasuretype](docs/Unitofmeasuretype.md)
 - [Vendor](docs/Vendor.md)
 - [VendorPurchase](docs/VendorPurchase.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization


Authentication schemes defined for the API:
<a id="oAuth"></a>
### oAuth

- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: https://login.windows.net/common/oauth2/authorize?resource=https://api.businesscentral.dynamics.com
- **Scopes**: 
 - **Financials.ReadWrite.All**: financials.read.write.all


## 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 *
```
