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.

1# main.py
2
3prices_response = client.catalog.get_catalog_prices(
4 ottimate_company_id=ottimate_company_id
5)
6
7print(f"Fetched {len(prices_response.results)} catalog prices.")
8for price in prices_response.results:
9 print(f" - Price ID: {price.id}, Price: {price.price}")

Fetching Catalog Prices with Filters

You can filter prices by effective date or location.

1# main.py
2
3from datetime import datetime
4
5# Filter by effective date
6today = datetime.now().strftime("%Y-%m-%d")
7prices_response = client.catalog.get_catalog_prices(
8 ottimate_company_id=ottimate_company_id,
9 effective_date=today
10)
11
12# Filter by location
13prices_response = client.catalog.get_catalog_prices(
14 ottimate_company_id=ottimate_company_id,
15 ottimate_location_id=location_id
16)
17
18# Filter by catalog entry
19prices_response = client.catalog.get_catalog_prices(
20 ottimate_company_id=ottimate_company_id,
21 catalog_entry_id=catalog_entry_id
22)

Creating a Catalog Price

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

1# main.py
2
3from datetime import datetime
4
5start_date = datetime.now()
6new_price = client.catalog.post_catalog_prices(
7 ottimate_company_id=ottimate_company_id,
8 catalog_entry_id=catalog_entry_id,
9 price=25.99,
10 start_date=start_date
11)
12print(f"Created catalog price with ID: {new_price.id}")

Bulk Creating Catalog Prices

You can create multiple catalog prices in a single request.

1# main.py
2
3from datetime import datetime, timedelta
4from ottimate.catalog.types.catalog_prices_bulk_create_request_prices_item import CatalogPricesBulkCreateRequestPricesItem
5
6start_date = datetime.now()
7
8prices = [
9 CatalogPricesBulkCreateRequestPricesItem(
10 catalog_entry_id=catalog_entry_id,
11 price=19.99,
12 start_date=start_date,
13 reference_id=f"bulk-price-1-{time_now}"
14 ),
15 CatalogPricesBulkCreateRequestPricesItem(
16 catalog_entry_id=catalog_entry_id,
17 price=21.99,
18 start_date=start_date + timedelta(days=30),
19 reference_id=f"bulk-price-2-{time_now}"
20 ),
21]
22
23bulk_response = client.catalog.post_catalog_prices_bulk(
24 ottimate_company_id=ottimate_company_id,
25 prices=prices
26)
27
28print(f"Bulk created {bulk_response.created_count} catalog prices.")