Skip to content

Latest commit

 

History

History
464 lines (347 loc) · 17.7 KB

CustomerApi.md

File metadata and controls

464 lines (347 loc) · 17.7 KB

pybusinesscentral.CustomerApi

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

Method HTTP request Description
delete_customer DELETE /companies({company_id})/customers({customer_id}) Deletes an object of type customer in Dynamics 365 Business Central
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.
list_customers GET /companies({company_id})/customers Returns a list of customers
patch_customer PATCH /companies({company_id})/customers({customer_id}) Updates an object of type customer in Dynamics 365 Business Central
post_customer POST /companies({company_id})/customers Creates an object of type customer in Dynamics 365 Business Central

delete_customer

delete_customer(company_id, customer_id)

Deletes an object of type customer in Dynamics 365 Business Central

Example

  • OAuth Authentication (oAuth):
import time
import pybusinesscentral
from pybusinesscentral.api import customer_api
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 = customer_api.CustomerApi(api_client)
    company_id = "company_id_example" # str | (v1.0) id for company
    customer_id = "customer_id_example" # str | (v1.0) id for customer

    # example passing only required values which don't have defaults set
    try:
        # Deletes an object of type customer in Dynamics 365 Business Central
        api_instance.delete_customer(company_id, customer_id)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->delete_customer: %s\n" % e)

Parameters

Name Type Description Notes
company_id str (v1.0) id for company
customer_id str (v1.0) id for customer

Return type

void (empty response body)

Authorization

oAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 (v1.0) Succesfully deleted the specified customer -

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

get_customer

Customer get_customer(company_id, customer_id)

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

Example

  • OAuth Authentication (oAuth):
import time
import pybusinesscentral
from pybusinesscentral.api import customer_api
from pybusinesscentral.model.customer import Customer
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 = customer_api.CustomerApi(api_client)
    company_id = "company_id_example" # str | (v1.0) id for company
    customer_id = "customer_id_example" # str | (v1.0) id for customer
    expand = [
        "customerFinancialDetails",
    ] # [str] | (v1.0) Entities to expand (optional)
    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 customer for Dynamics 365 Business Central.
        api_response = api_instance.get_customer(company_id, customer_id)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->get_customer: %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 customer for Dynamics 365 Business Central.
        api_response = api_instance.get_customer(company_id, customer_id, expand=expand, select=select)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->get_customer: %s\n" % e)

Parameters

Name Type Description Notes
company_id str (v1.0) id for company
customer_id str (v1.0) id for customer
expand [str] (v1.0) Entities to expand [optional]
select [str] (v1.0) Selected properties to be retrieved [optional]

Return type

Customer

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 customer -

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

list_customers

InlineResponse2001 list_customers(company_id)

Returns a list of customers

Example

  • OAuth Authentication (oAuth):
import time
import pybusinesscentral
from pybusinesscentral.api import customer_api
from pybusinesscentral.model.inline_response2001 import InlineResponse2001
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 = customer_api.CustomerApi(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)
    expand = [
        "customerFinancialDetails",
    ] # [str] | (v1.0) Entities to expand (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 customers
        api_response = api_instance.list_customers(company_id)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->list_customers: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Returns a list of customers
        api_response = api_instance.list_customers(company_id, top=top, skip=skip, limit=limit, filter=filter, expand=expand, select=select)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->list_customers: %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]
expand [str] (v1.0) Entities to expand [optional]
select [str] (v1.0) Selected properties to be retrieved [optional]

Return type

InlineResponse2001

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 customers -

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

patch_customer

Customer patch_customer(company_id, customer_id, content_type, if_match, unknown_base_type)

Updates an object of type customer in Dynamics 365 Business Central

Example

  • OAuth Authentication (oAuth):
import time
import pybusinesscentral
from pybusinesscentral.api import customer_api
from pybusinesscentral.model.customer import Customer
from pybusinesscentral.model.unknownbasetype import UNKNOWNBASETYPE
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 = customer_api.CustomerApi(api_client)
    company_id = "company_id_example" # str | (v1.0) id for company
    customer_id = "customer_id_example" # str | (v1.0) id for customer
    content_type = "Content-Type_example" # str | (v1.0) application/json
    if_match = "If-Match_example" # str | (v1.0) Required. When this request header is included and the eTag provided does not match the current tag on the entity, this will not be updated.
    unknown_base_type = None # UNKNOWN_BASE_TYPE | 

    # example passing only required values which don't have defaults set
    try:
        # Updates an object of type customer in Dynamics 365 Business Central
        api_response = api_instance.patch_customer(company_id, customer_id, content_type, if_match, unknown_base_type)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->patch_customer: %s\n" % e)

Parameters

Name Type Description Notes
company_id str (v1.0) id for company
customer_id str (v1.0) id for customer
content_type str (v1.0) application/json
if_match str (v1.0) Required. When this request header is included and the eTag provided does not match the current tag on the entity, this will not be updated.
unknown_base_type UNKNOWN_BASE_TYPE

Return type

Customer

Authorization

oAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 (v1.0) Succesfully updated the specifiedcustomer -

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

post_customer

Customer post_customer(company_id, content_type, unknown_base_type)

Creates an object of type customer in Dynamics 365 Business Central

Example

  • OAuth Authentication (oAuth):
import time
import pybusinesscentral
from pybusinesscentral.api import customer_api
from pybusinesscentral.model.customer import Customer
from pybusinesscentral.model.unknownbasetype import UNKNOWNBASETYPE
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 = customer_api.CustomerApi(api_client)
    company_id = "company_id_example" # str | (v1.0) id for company
    content_type = "Content-Type_example" # str | (v1.0) application/json
    unknown_base_type = None # UNKNOWN_BASE_TYPE | 
    expand = [
        "customerFinancialDetails",
    ] # [str] | (v1.0) Entities to expand (optional)

    # example passing only required values which don't have defaults set
    try:
        # Creates an object of type customer in Dynamics 365 Business Central
        api_response = api_instance.post_customer(company_id, content_type, unknown_base_type)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->post_customer: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Creates an object of type customer in Dynamics 365 Business Central
        api_response = api_instance.post_customer(company_id, content_type, unknown_base_type, expand=expand)
        pprint(api_response)
    except pybusinesscentral.ApiException as e:
        print("Exception when calling CustomerApi->post_customer: %s\n" % e)

Parameters

Name Type Description Notes
company_id str (v1.0) id for company
content_type str (v1.0) application/json
unknown_base_type UNKNOWN_BASE_TYPE
expand [str] (v1.0) Entities to expand [optional]

Return type

Customer

Authorization

oAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 (v1.0) A new customer has been succesfully created -

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