NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!

Please go ahead to the new site!

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Wrapper for the '/products' and '/sales' APIs. NB! Product service might not be present in all servers

List of all options:

Catalog management

from trivoreid.utils.criteria import Filter
from trivoreid.models.products import Catalog

# get page with first five catalogs with the ownerId '1234'
f = Filter(Filter.EQUALS, 'ownerId', '1234')
page = api.product_service.get_all_catalogs(f, start_index=0, count=5)

# create new catalog
catalog = Catalog()
catalog.ownerId = '1234'
catalog.name = "Example Catalog"

# the function returns catalog object with the generated id
catalog = api.product_service.create_catalog(catalog)

# update catalog
catalog.name = "Catalog Example"
catalog = api.product_service.update_catalog(catalog)

# get catalog
catalog = api.product_service.get_catalog(catalog.id)

#delete catalog
api.product_service.delete_catalog(catalog.id)

Pricing plan management

from trivoreid.utils.criteria import Filter
from trivoreid.models.products import PricingPlan

# get page with first five pricing plans that are enabled
f = Filter(Filter.EQUALS, 'enabled', 'true')
page = api.product_service.get_all_pricing_plans(f, start_index=0, count=5)

# create new pricing plan
pricingPlan = PricingPlan()
pricingPlan.description = 'New pricing plan'
pricingPlan.title = 'Pricing plan'
pricingPlan.ownerID = '1234'

# the function returns pricing plan object with the generated id
pricingPlan = api.product_service.create_pricing_plan(pricingPlan)

# update pricing plan
pricingPlan .title = "pricing plan Example"
pricingPlan = api.product_service.update_pricing_plan(pricingPlan)

# get pricing plan
pricingPlan = api.product_service.get_pricing_plan(pricingPlan .id)

#delete pricing plan 
api.product_service.delete_pricing_plan(pricingPlan.id)

Product management

from trivoreid.utils.criteria import Filter
from trivoreid.models.products import Product

# get page with first five pricing plans that have ownerId of '1234'
f = Filter(Filter.EQUALS, 'ownerId', '1234')
page = api.product_service.get_all_products(f, start_index=0, count=5)

# create new pricing plan
product = Product()
product.sku = 'B12'
product.ownerID = '1234'

# the function returns product object with the generated id
product = api.product_service.create_product(product)

# update product
product.sku = 'C12'
product = api.product_service.update_product(product)

# get product
product = api.product_service.get_product(product.id)

#delete product
api.product_service.delete_product(product.id)

Catalog and Item details

# get all accessible catalogs and their product item details.
# this method will return AllCatalogs object with the list of catalogs' details
all_catalogs = api.product_service.get_all_catalogs_and_items()

# apply parameters
all_catalogs = api.product_service.get_all_catalogs_and_items(locale='en',
															currency='EUR',
															customerSegment=['segmentId'],
															atTime='2020-12-03T10:15:30.00Z')


# get catalog and its product item details
# this method will return CatalogDetails object
catalogId = all_catalogs.catalogs[0].catalogId
catalog_details = api.product_service.get_catalog_details(catalogId)

# apply parameters
catalog_details = api.product_service.get_catalog_details(catalogId,
														locale='en',
														currency='GBP',
														code=['priceDiscountCode1', 'priceDiscountCode2'],
														volume=3)

# get product details
# this method will return ProductDetails object
productId = catalog_details.products[0].productId
product_details = api.product_service.get_product_details(catalogId, productId)

# apply parameters
product_details = api.product_service.get_product_details(catalogId,
														productId,
														locale='fi',
														volume=5)

Service models

/wiki/spaces/TISpubdoc/pages/20515259

/wiki/spaces/TISpubdoc/pages/20515258

/wiki/spaces/TISpubdoc/pages/20515198

/wiki/spaces/TISpubdoc/pages/20515197

/wiki/spaces/TISpubdoc/pages/20515208

/wiki/spaces/TISpubdoc/pages/20515202

/wiki/spaces/TISpubdoc/pages/20515203

/wiki/spaces/TISpubdoc/pages/20515204

/wiki/spaces/TISpubdoc/pages/20515201

/wiki/spaces/TISpubdoc/pages/20515200

/wiki/spaces/TISpubdoc/pages/20515199


  • No labels