Skip to content

Latest commit

 

History

History
198 lines (148 loc) · 7.46 KB

AccountApi.md

File metadata and controls

198 lines (148 loc) · 7.46 KB

pybusinesscentral.AccountApi

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

Method HTTP request Description
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.
list_accounts GET /companies({company_id})/accounts Returns a list of accounts

get_account

Account get_account(company_id, account_id)

Retrieve the properties and relationships of an object of type account for Dynamics 365 Business Central.

Example

  • OAuth Authentication (oAuth):
import time
import pybusinesscentral
from pybusinesscentral.api import account_api
from pybusinesscentral.model.account import Account
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.

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

    # example passing only required values which don't have defaults set
    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)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling AccountApi->get_account: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    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)

Parameters

Name Type Description Notes
company_id str (v1.0) id for company
account_id str (v1.0) id for account
select [str] (v1.0) Selected properties to be retrieved [optional]

Return type

Account

Authorization

oAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 (v1.0) Succesfully returned the requested account -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_accounts

InlineResponse2005 list_accounts(company_id)

Returns a list of accounts

Example

  • OAuth Authentication (oAuth):
import time
import pybusinesscentral
from pybusinesscentral.api import account_api
from pybusinesscentral.model.inline_response2005 import InlineResponse2005
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.

# 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
    top = 1 # int | (v1.0) Number of items to return from the top of the list (optional)
    skip = 1 # int | (v1.0) Number of items to skip from the list (optional)
    limit = 1 # int | (v1.0) Number of items to return from the list (optional)
    filter = "$filter_example" # str | (v1.0) Filtering expression (optional)
    select = [
        "id",
    ] # [str] | (v1.0) Selected properties to be retrieved (optional)

    # example passing only required values which don't have defaults set
    try:
        # Returns a list of accounts
        api_response = api_instance.list_accounts(company_id)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling AccountApi->list_accounts: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Returns a list of accounts
        api_response = api_instance.list_accounts(company_id, top=top, skip=skip, limit=limit, filter=filter, select=select)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling AccountApi->list_accounts: %s\n" % e)

Parameters

Name Type Description Notes
company_id str (v1.0) id for company
top int (v1.0) Number of items to return from the top of the list [optional]
skip int (v1.0) Number of items to skip from the list [optional]
limit int (v1.0) Number of items to return from the list [optional]
filter str (v1.0) Filtering expression [optional]
select [str] (v1.0) Selected properties to be retrieved [optional]

Return type

InlineResponse2005

Authorization

oAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 (v1.0) Succesfully returned a list of accounts -

[Back to top] [Back to API list] [Back to Model list] [Back to README]