Catalog

This section explains how to interact with catalog entries using the Ottimate SDK.

Fetching Catalog Entries

You can retrieve a list of catalog entries for a specific company. It’s also possible to filter these entries, for example, by vendor_name.

1# Fetch catalog entries for a company
2catalog_entries = client.catalog.get_catalog_entries(
3 ottimate_company_id=ottimate_company_id
4)
5
6print(f"Fetched {len(catalog_entries.results)} catalog entries.")
7for entry in catalog_entries.results:
8 print(f" - Catalog Entry: Ottimate ID: {entry.id} | Name: {entry.description}")

Creating a Catalog Entry

This example shows how to create a new catalog entry.

1new_catalog_entry = client.catalog.post_catalog_entries(
2 ottimate_company_id=ottimate_company_id,
3 description=f"SDK Catalog Item {time_now}",
4 price=10.99,
5 erp_vendor_name="AWG"
6)
7
8print(f"✅ Created catalog entry with ID: {new_catalog_entry.id}")

Fetching a Single Catalog Entry

You can retrieve a specific catalog entry by its ID.

1fetched_entry = client.catalog.get_catalog_entries_id(
2 id=catalog_entry_id
3)
4print(f"✅ Fetched catalog entry: {fetched_entry}")

Updating a Catalog Entry

This shows how to update an existing catalog entry, for example, to change its price.

1updated_entry = client.catalog.patch_catalog_entries_id(
2 id=catalog_entry_id,
3 price=11
4)
5print(f"✅ Updated catalog entry price to: {updated_entry.price}")

Bulk Creating Catalog Entries

You can also create multiple catalog entries in a single request.

1bulk_entries = [
2 {"description": f"Bulk Item 1 {time_now}", "code": f"SDK-BULK1-{time_now}", "price": 5.99, "unit": "EACH", "erp_vendor_name": "AWG"},
3 {"description": f"Bulk Item 2 {time_now}", "code": f"SDK-BULK2-{time_now}", "price": 7.49, "unit": "EACH", "erp_vendor_name": "AWG"},
4]
5bulk_response = client.catalog.post_catalog_entries_bulk(
6 ottimate_company_id=ottimate_company_id,
7 entries=bulk_entries
8)
9# Print summary of bulk creation
10print(f"✅ Bulk created {bulk_response.success_count} catalog entries.")
11# Print details of created entries
12if hasattr(bulk_response, "created") and bulk_response.created:
13 print("Created entries:")
14 for entry in bulk_response.created:
15 print(f" - ID: {entry.get('id')}, Description: {entry.get('description')}")
16# Print details of updated entries
17if hasattr(bulk_response, "updated") and bulk_response.updated:
18 print("Updated entries:")
19 for entry in bulk_response.updated:
20 print(f" - ID: {entry.get('id')}, Description: {entry.get('description')}")
21# Print details of errors
22if hasattr(bulk_response, "errors") and bulk_response.errors:
23 print("Failed entries:")
24 for error in bulk_response.errors:
25 print(f" - Error: {error}")
26else:
27 print("No failures in bulk creation.")

Catalog Allowances

This section covers managing catalog allowances.

Fetching Catalog Allowances

You can retrieve all allowances for a company, with optional filters.

1catalog_allowances = client.catalog.get_catalog_allowances(
2 ottimate_company_id=ottimate_company_id,
3)
4print(f"✅ Fetched {len(catalog_allowances.results)} catalog allowances.")
5for allowance in catalog_allowances.results:
6 print(f" - Allowance ID: {allowance.id}, Amount: {allowance.amount}, Catalog Entry: {allowance.catalog_entry_id}")

Creating a Catalog Allowance

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

1start_date = datetime.now()
2end_date = start_date + timedelta(days=30)
3new_allowance = client.catalog.post_catalog_allowances(
4 ottimate_company_id=ottimate_company_id,
5 catalog_entry_id=catalog_entry_id,
6 amount=8.50,
7 start_date=start_date,
8 end_date=end_date
9)
10print(f"✅ Created catalog allowance with ID {new_allowance}")

Updating a Catalog Allowance

You can update an existing allowance by its ID.

1allowance_id = "cta_2_RQGdxm~4z2"
2updated_allowance = client.catalog.patch_catalog_allowances_id(
3 id=allowance_id,
4 amount=3.00
5)
6print(f"✅ Updated catalog allowance ID {allowance_id} to new amount: {updated_allowance.amount}")

Bulk Creating Catalog Allowances

This example demonstrates how to create multiple allowances in a single API call.

1bulk_response = client.catalog.post_catalog_allowances_bulk(
2 ottimate_company_id=ottimate_company_id,
3 allowances=[{
4 "catalog_entry_id": "cte_jgNeV9o_h0Tj",
5 "allowance_type": "rebate",
6 "amount": 999,
7 "start_date": "2025-12-01"
8 }]
9)
10print(f"✅ Bulk created {bulk_response.success_count} catalog allowances.")
11if hasattr(bulk_response, "created") and bulk_response.created:
12 print("Created allowances:")
13 for allowance in bulk_response.created:
14 print(f" - ID: {allowance.get('id')}, Catalog Entry: {allowance.get('catalog_entry_id')}, Amount: {allowance.get('amount')}")
15if hasattr(bulk_response, "updated") and bulk_response.updated:
16 print("Updated allowances:")
17 for allowance in bulk_response.updated:
18 print(f" - ID: {allowance.get('id')}, Catalog Entry: {allowance.get('catalog_entry_id')}, Amount: {allowance.get('amount')}")
19if hasattr(bulk_response, "errors") and bulk_response.errors:
20 print("Failed allowances:")
21 for error in bulk_response.errors:
22 print(f" - Error: {error}")
23else:
24 print("No failures in bulk creation.")

Catalog Variances

This section explains how to work with catalog variances.

Fetching Catalog Variances

You can retrieve a list of catalog variances for a given company.

1# Fetching catalog variances for company
2variances_response = client.catalog.get_catalog_variances(
3 ottimate_company_id=ottimate_company_id,
4 limit=5
5)
6
7for variance in variances_response.results:
8 print(f" - Catalog Entry ID: {variance.id}, Invoice Item ID: {variance.last_invoice_item.id}")

Fetching Invoice Items for a Variance

You can fetch the invoice items associated with a specific catalog variance by its ID.

1invoice_items = client.catalog.get_catalog_variances_id_invoice_items(id=catalog_entry_id)
2print(f"✅ Fetched variance details for catalog entry ID {catalog_entry_id}: {invoice_items.results}")