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: object

Client 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, optional) – Search criteria. Defaults to empty dict.

Returns:

Count of products matching the criteria

Return type:

int

fetch_products(criteria=None, page_size=1000)[source]

Fetch products using the Content1 API

Parameters:
  • criteria (dict, 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:

dict

fetch_hierarchies(criteria=None, page_size=1000)[source]

Fetch product hierarchies using the Content1 API

Parameters:
  • criteria (dict, 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:

dict

fetch_products_by_gtin(gtins, page_size=1000)[source]

Fetch products by GTIN

Parameters:
  • gtins (list) – List of GTINs to fetch

  • page_size (int, optional) – Number of products to return per page. Defaults to 1000.

Returns:

Product fetch results

Return type:

dict

fetch_products_by_ip_gln(ip_gln, page_size=1000)[source]

Fetch products by Information Provider GLN

Parameters:
  • ip_gln (str) – Information Provider GLN

  • page_size (int, optional) – Number of products to return per page. Defaults to 1000.

Returns:

Product fetch results

Return type:

dict

fetch_products_by_target_market(target_market, page_size=1000)[source]

Fetch products by target market

Parameters:
  • target_market (str) – Target market code (e.g., ‘US’)

  • page_size (int, optional) – Number of products to return per page. Defaults to 1000.

Returns:

Product fetch results

Return type:

dict

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) – Previous response from fetch_products

  • page_size (int, optional) – Number of products to return per page. Defaults to 1000.

  • original_criteria (dict, optional) – Original search criteria to preserve. Defaults to None.

Returns:

Next page of product fetch results

Return type:

dict