Skip to navigation

Catalog Prices

This section explains how to work with catalog prices using the Ottimate SDK.

Fetching Catalog Prices

You can retrieve a list of catalog prices for a specific company.

# main.py
prices_response = client.catalog.get_catalog_prices(
ottimate_company_id=ottimate_company_id
)
print(f"Fetched {len(prices_response.results)} catalog prices.")
for price in prices_response.results:
print(f" - Price ID: {price.id}, Price: {price.price}")

Fetching Catalog Prices with Filters

You can filter prices by effective date or location.

# main.py
from datetime import datetime
# Filter by effective date
today = datetime.now().strftime("%Y-%m-%d")
prices_response = client.catalog.get_catalog_prices(
ottimate_company_id=ottimate_company_id,
effective_date=today
)
# Filter by location
prices_response = client.catalog.get_catalog_prices(
ottimate_company_id=ottimate_company_id,
ottimate_location_id=location_id
)
# Filter by catalog entry
prices_response = client.catalog.get_catalog_prices(
ottimate_company_id=ottimate_company_id,
catalog_entry_id=catalog_entry_id
)

Creating a Catalog Price

This example shows how to create a new price for a catalog entry.

# main.py
from datetime import datetime
start_date = datetime.now()
new_price = client.catalog.post_catalog_prices(
ottimate_company_id=ottimate_company_id,
catalog_entry_id=catalog_entry_id,
price=25.99,
start_date=start_date
)
print(f"Created catalog price with ID: {new_price.id}")

Bulk Creating Catalog Prices

You can create multiple catalog prices in a single request.

# main.py
from datetime import datetime, timedelta
from ottimate.catalog.types.catalog_prices_bulk_create_request_prices_item import CatalogPricesBulkCreateRequestPricesItem
start_date = datetime.now()
prices = [
CatalogPricesBulkCreateRequestPricesItem(
catalog_entry_id=catalog_entry_id,
price=19.99,
start_date=start_date,
reference_id=f"bulk-price-1-{time_now}"
),
CatalogPricesBulkCreateRequestPricesItem(
catalog_entry_id=catalog_entry_id,
price=21.99,
start_date=start_date + timedelta(days=30),
reference_id=f"bulk-price-2-{time_now}"
),
]
bulk_response = client.catalog.post_catalog_prices_bulk(
ottimate_company_id=ottimate_company_id,
prices=prices
)
print(f"Bulk created {bulk_response.created_count} catalog prices.")