Push merchants' data from your ecommerce or point-of-sale (POS) platform into your merchants' accounting platform.
Project description
Sync for Commerce version 1
Embedded accounting integrations for POS and eCommerce platforms.
SDK Installation
pip install codat-sync-for-commerce-version-1
Example Usage
SDK Example Usage
Example
import codatsynccommerce
from codatsynccommerce.models import operations, shared
s = codatsynccommerce.CodatSyncCommerce(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)
req = operations.GetConfigTextSyncFlowRequest(
locale=shared.Locale.EN_US,
)
res = s.sync_flow_preferences.get_config_text_sync_flow(req)
if res.localization_info is not None:
# handle response
pass
Available Resources and Operations
sync_flow_preferences
- get_config_text_sync_flow - Retrieve preferences for text fields on sync flow
- get_sync_flow_url - Retrieve sync flow url
- get_visible_accounts - List visible accounts
- update_config_text_sync_flow - Update preferences for text fields on sync flow
- update_visible_accounts_sync_flow - Update the visible accounts on sync flow
companies
- delete_company - Delete a company
- get_company - Get company
- update_company - Update company
connections
- delete_connection - Delete connection
- get_connection - Get connection
- unlink - Unlink connection
accounting_bank_accounts
- get_accounting_bank_account - Get bank account
- list_accounting_bank_accounts - List bank accounts
commerce_customers
- get_commerce_customer - Get customer
- list_commerce_customers - List customers
commerce_company_info
- get_commerce_company_info - Get company info
commerce_locations
- get_commerce_location - Get location
- list_commerce_locations - List locations
commerce_orders
- get_commerce_order - Get order
- list_commerce_orders - List orders
commerce_payments
- get_commerce_payment - Get payment
- get_method - Get payment method
- list_commerce_payments - List payments
- list_methods - List payment methods
commerce_products
- get_commerce_product - Get product
- list_commerce_products - List products
commerce_transactions
- get_commerce_transaction - Get transaction
- list_commerce_transactions - List transactions
accounting_accounts
- create_accounting_account - Create account
- get_accounting_account - Get account
- list_accounting_accounts - List accounts
accounting_credit_notes
- create_accounting_credit_note - Create credit note
accounting_customers
- create_accounting_customer - Create customer
accounting_direct_incomes
- create_accounting_direct_income - Create direct income
accounting_invoices
- create_accounting_invoice - Create invoice
accounting_journal_entries
- create_accounting_journal_entry - Create journal entry
accounting_payments
- create_accounting_payment - Create payment
refresh_data
- all - Refresh all data
- by_data_type - Refresh data type
- get_company_data_status - Get data status
- get_pull_operation - Get pull operation
- list_pull_operations - List pull operations
accounting_company_info
- get_accounting_company_info - Get company info
- refresh - Refresh company info
push_data
- get_operation - Get push operation
- list_operations - List push operations
sync
- get_sync_status - Get status for a company's syncs
- request_sync - Sync new
- request_sync_for_date_range - Sync range
configuration
- get_configuration - Retrieve config preferences set for a company
- set_configuration - Create or update configuration
integrations
- get_integration_branding - Get branding for an integration
- list_integrations - List integrations
company_management
- create_company - Create sync for commerce company
- create_connection - Create connection
- list_companies - List companies
- list_connections - List data connections
- update_connection - Update data connection
Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
import codatsynccommerce
from codatsynccommerce.models import operations, shared
from codatsynccommerce.utils import BackoffStrategy, RetryConfig
s = codatsynccommerce.CodatSyncCommerce(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)
req = operations.GetConfigTextSyncFlowRequest(
locale=shared.Locale.EN_US,
)
res = s.sync_flow_preferences.get_config_text_sync_flow(req,
RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False))
if res.localization_info is not None:
# handle response
pass
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
import codatsynccommerce
from codatsynccommerce.models import operations, shared
from codatsynccommerce.utils import BackoffStrategy, RetryConfig
s = codatsynccommerce.CodatSyncCommerce(
retry_config=RetryConfig('backoff', BackoffStrategy(1, 50, 1.1, 100), False)
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)
req = operations.GetConfigTextSyncFlowRequest(
locale=shared.Locale.EN_US,
)
res = s.sync_flow_preferences.get_config_text_sync_flow(req)
if res.localization_info is not None:
# handle response
pass
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
Error Object | Status Code | Content Type |
---|---|---|
errors.ErrorMessage | 401,402,403,429,500,503 | application/json |
errors.SDKError | 400-600 | / |
Example
import codatsynccommerce
from codatsynccommerce.models import operations, shared
s = codatsynccommerce.CodatSyncCommerce(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)
req = operations.GetConfigTextSyncFlowRequest(
locale=shared.Locale.EN_US,
)
res = None
try:
res = s.sync_flow_preferences.get_config_text_sync_flow(req)
except errors.ErrorMessage as e:
print(e) # handle exception
raise(e)
except errors.SDKError as e:
print(e) # handle exception
raise(e)
if res.localization_info is not None:
# handle response
pass
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the server_idx: int
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
# | Server | Variables |
---|---|---|
0 | https://api.codat.io |
None |
Example
import codatsynccommerce
from codatsynccommerce.models import operations, shared
s = codatsynccommerce.CodatSyncCommerce(
server_idx=0,
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)
req = operations.GetConfigTextSyncFlowRequest(
locale=shared.Locale.EN_US,
)
res = s.sync_flow_preferences.get_config_text_sync_flow(req)
if res.localization_info is not None:
# handle response
pass
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the server_url: str
optional parameter when initializing the SDK client instance. For example:
import codatsynccommerce
from codatsynccommerce.models import operations, shared
s = codatsynccommerce.CodatSyncCommerce(
server_url="https://api.codat.io",
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)
req = operations.GetConfigTextSyncFlowRequest(
locale=shared.Locale.EN_US,
)
res = s.sync_flow_preferences.get_config_text_sync_flow(req)
if res.localization_info is not None:
# handle response
pass
Custom HTTP Client
The Python SDK makes API calls using the (requests)[https://pypi.org/project/requests/] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom requests.Session
object.
For example, you could specify a header for every request that this sdk makes as follows:
import codatsynccommerce
import requests
http_client = requests.Session()
http_client.headers.update({'x-custom-header': 'someValue'})
s = codatsynccommerce.CodatSyncCommerce(client: http_client)
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
auth_header |
apiKey | API key |
You can set the security parameters through the security
optional parameter when initializing the SDK client instance. For example:
import codatsynccommerce
from codatsynccommerce.models import operations, shared
s = codatsynccommerce.CodatSyncCommerce(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
)
req = operations.GetConfigTextSyncFlowRequest(
locale=shared.Locale.EN_US,
)
res = s.sync_flow_preferences.get_config_text_sync_flow(req)
if res.localization_info is not None:
# handle response
pass
Support
If you encounter any challenges while utilizing our SDKs, please don't hesitate to reach out for assistance. You can raise any issues by contacting your dedicated Codat representative or reaching out to our support team. We're here to help ensure a smooth experience for you.
Library generated by Speakeasy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file codat-sync-for-commerce-version-1-0.3.0.tar.gz
.
File metadata
- Download URL: codat-sync-for-commerce-version-1-0.3.0.tar.gz
- Upload date:
- Size: 94.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b474d3355ddb1576121b7976e7680cfa354ae0a83a4a9733901ac938fbce5fed |
|
MD5 | 58476053abe4f1f2eb14ff997045ae6c |
|
BLAKE2b-256 | d396a99fabe5a0d98d38829657616e16e63044eac80b9d2b8cf61a775cb07cd3 |
File details
Details for the file codat_sync_for_commerce_version_1-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: codat_sync_for_commerce_version_1-0.3.0-py3-none-any.whl
- Upload date:
- Size: 266.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4d53930cf73ab3d25ac643369593cb9c67b1c4fce8276798d22c4c63f191a03 |
|
MD5 | c3155be392bb3de516461e6670edee4e |
|
BLAKE2b-256 | c9145f455a05a9aced2c5e85f1038e76424d5a00ff44eba96bdd2c41e2dbd49e |