Products¶
SanMar publishes its catalog three ways. For the whole catalog, or anything refreshed daily, SanMar asks that you read its files rather than call its services style by style.
Need |
Use |
|---|---|
The whole catalog, refreshed monthly or daily |
|
One style, on demand |
|
What changed since last time |
|
Images and spec sheets |
|
SanMar’s product information service¶
get() returns one
ProductInfo per style, color and size, with its images and
prices flattened in:
for item in sanmar.products.get("K500", catalog_color="Black"):
print(item.size, item.unique_key, item.prices.piece_price, item.images.front_model)
Narrow by catalog color, by size, or both; see Identifiers for which color.
get_many() looks up several styles in one
call.
Product files on request¶
The same service can ask SanMar to write a product file to the SFTP server, about 20
minutes later, in SanMarPDD/SanMarPI:
request = sanmar.products.request_brand_file("Port & Co")
request.file_pattern # 'Brand_PortCo_*.csv': SanMar dates brand and category files
# Later, over SFTP:
with SanMarFTP(123456, "ftp-password", host_key=KEY) as ftp:
name = ftp.newest(request.folder, request.file_pattern)
with ftp.product_information(name) as products:
for product in products:
...
request_bulk_file() writes the whole catalog
(SanMar allows it once a month) and
request_delta_file() what changed since the
last bulk or delta file (once a day). A delta file consumes the changes it reports: the
next one starts from it.
PromoStandards Product Data¶
get() describes a whole style: its
descriptions, categories, keywords, price groups and every part (color and size), with
GTINs, dimensions and case packs.
product = sanmar.promostandards.product_data.get("K500")
for part in product.parts:
print(part.part_id, part.catalog_color, part.apparel_size.size, part.gtin)
The list methods return PartReference items:
closeouts()lists every discontinued part.modified_since()lists what changed after a point in time.sellable()lists what SanMar sells, across the catalog or within a style.
Media¶
get() lists a style’s images or
documents. SanMar recommends asking for a whole style, which returns every color’s images
in one call:
from sanmar_sdk.promostandards import ClassType, MediaType
fronts = sanmar.promostandards.media_content.get("K500", class_type=ClassType.FRONT)
documents = sanmar.promostandards.media_content.get("K500", media_type=MediaType.DOCUMENT)
SanMar serves images and documents only, not audio or video.