Content1 Client API
The content1_client module provides the main interface for interacting with the 1WorldSync Content1 API.
Content1Client
- class oneworldsync.content1_client.Content1Client(app_id=None, secret_key=None, gln=None, api_url=None, timeout=30)[source]
Bases:
objectClient for the 1WorldSync Content1 API
This class provides methods for interacting with the 1WorldSync Content1 API, handling authentication, request construction, and response parsing.
- __init__(app_id=None, secret_key=None, gln=None, api_url=None, timeout=30)[source]
Initialize the 1WorldSync Content1 API client
- Parameters:
app_id (str, optional) – The application ID provided by 1WorldSync. If None, will try to get from ONEWORLDSYNC_APP_ID environment variable.
secret_key (str, optional) – The secret key provided by 1WorldSync. If None, will try to get from ONEWORLDSYNC_SECRET_KEY environment variable.
gln (str, optional) – Global Location Number for the user. If None, will try to get from ONEWORLDSYNC_USER_GLN environment variable.
api_url (str, optional) – The API URL to use. If None, will try to get from ONEWORLDSYNC_CONTENT1_API_URL environment variable. Defaults to production API if not specified.
timeout (int, optional) – Request timeout in seconds. Defaults to 30.
- count_products(criteria=None)[source]
Count products using the Content1 API
- Parameters:
criteria (dict or ProductCriteria, optional) – Search criteria. Defaults to empty dict.
- Returns:
Count of products matching the criteria
- Return type:
- fetch_products(criteria=None, page_size=1000)[source]
Fetch products using the Content1 API
- Parameters:
criteria (dict or ProductCriteria, optional) – Search criteria. Defaults to empty dict.
page_size (int, optional) – Number of products to return per page. Defaults to 1000.
- Returns:
Product fetch results
- Return type:
- fetch_hierarchies(criteria=None, page_size=1000)[source]
Fetch product hierarchies using the Content1 API
- Parameters:
criteria (dict or ProductCriteria, optional) – Search criteria. Defaults to empty dict.
page_size (int, optional) – Number of hierarchies to return per page. Defaults to 1000.
- Returns:
Hierarchy fetch results
- Return type:
- fetch_products_by_ip_gln(ip_gln, page_size=1000)[source]
Fetch products by Information Provider GLN
- fetch_products_by_target_market(target_market, page_size=1000)[source]
Fetch products by target market
- fetch_next_page(previous_response, page_size=1000, original_criteria=None)[source]
Fetch the next page of products using the searchAfter value from a previous response
- Parameters:
previous_response (dict or Content1ProductResults) – Previous response from fetch_products
page_size (int, optional) – Number of products to return per page. Defaults to 1000.
original_criteria (dict or ProductCriteria, optional) – Original search criteria to preserve. Defaults to None.
- Returns:
Next page of product fetch results
- Return type:
- fetch_products_by_date_range(from_date, to_date, target_market=None, page_size=1000)[source]
Fetch products by last modified date range
- Parameters:
- Returns:
Product fetch results
- Return type:
- fetch_products_last_30_days(target_market=None, page_size=1000)[source]
Fetch products modified in the last 30 days
- Parameters:
- Returns:
Product fetch results
- Return type:
- fetch_products_by_brand(brand_name, target_market=None, page_size=1000)[source]
Fetch products by brand name
- Parameters:
- Returns:
Product fetch results
- Return type:
- fetch_products_by_gpc_code(gpc_code, target_market=None, page_size=1000)[source]
Fetch products by GPC code
- Parameters:
- Returns:
Product fetch results
- Return type: