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 2 Next »

Wrapper for the '/sales' API. Please note that the Sales service might not be present in all servers

List of all options:

Catalog management

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

# get page with first five catalogs with the ownerId '1234'
f = Filter(Filter.EQUALS, 'ownerId', '1234')
page = api.sales_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.sales_service.create_catalog(catalog)

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

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

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

Pricing plan management

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

# get page with first five pricing plans that are enabled
f = Filter(Filter.EQUALS, 'enabled', 'true')
page = api.sales_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.sales_service.create_pricing_plan(pricingPlan)

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

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

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

Product management

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

# get page with first five pricing plans that have ownerId of '1234'
f = Filter(Filter.EQUALS, 'ownerId', '1234')
page = api.sales_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.sales_service.create_product(product)

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

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

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

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