constructor_io.modules package
Submodules
constructor_io.modules.autocomplete module
Autocomplete Module
- class constructor_io.modules.autocomplete.Autocomplete(options)
Bases:
objectAutocomplete Class
- get_autocomplete_results(query, parameters=None, user_parameters=None)
Retrieve autocomplete results from API
- Parameters:
query (str) – Autocomplete query
parameters (dict) – Additional parameters to refine result set
parameters.num_results (int) – The total number of results to return
parameters.filters (dict) – Filters used to refine search
parameters.filters_by_section (dict) – Filters used to refine search by section
parameters.results_per_section (dict) – Number of results to return per section
parameters.hidden_fields (list) – Hidden metadata fields to return
parameters.variations_map (dict) – The variations map dictionary to aggregate variations. Please refer to https://docs.constructor.com/reference/shared-variations-mapping for details
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
constructor_io.modules.browse module
Browse Module
- class constructor_io.modules.browse.Browse(options)
Bases:
objectBrowse Class
- get_browse_facet_options(facet_name, parameters=None, user_parameters=None)
Retrieve facet options for a given facet group from the API
- Parameters:
facet_name (str) – Name of the facet whose options to return
parameters (dict) – Additional parameters to refine result set
parameters.section (str) – Section name for results
parameters.fmt_options (dict) – The format options used to refine result groups
parameters.fmt_options.show_hidden_facets (int) – Include facets configured as hidden
parameters.fmt_options.show_protected_facets (int) – Include facets configured as protected
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
- get_browse_facets(parameters=None, user_parameters=None)
Retrieve facets from API
- Parameters:
parameters (dict) – Additional parameters to refine result set
parameters.page (dict) – The page number of the results
parameters.results_per_page (dict) – The number of results per page to return
parameters.section (str) – Section name for results
parameters.fmt_options (dict) – The format options used to refine result groups
parameters.fmt_options.show_hidden_facets (int) – Include facets configured as hidden
parameters.fmt_options.show_protected_facets (int) – Include facets configured as protected
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
- get_browse_groups(parameters=None, user_parameters=None)
Retrieve groups from API
- Parameters:
parameters (dict) – Additional parameters to refine result set
parameters.filters (dict) – Filters used to refine results
parameters.section (str) – Section name for results
parameters.fmt_options (dict) – The format options used to refine result groups
parameters.fmt_options.groups_max_depth (int) – The maximum depth of the hierarchy group structure
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
- get_browse_results(filter_name, filter_value, parameters=None, user_parameters=None)
Retrieve browse results from API
- Parameters:
filter_name (str) – Filter name to display results from
filter_value (str) – Filter value to display results from
parameters (dict) – Additional parameters to refine result set
parameters.page (int) – The page number of the results
parameters.results_per_page (int) – The number of results per page to return
parameters.filters (dict) – Filters used to refine results
parameters.sort_by (str) – The sort method for results
parameters.sort_order (str) – The sort order for results
parameters.section (str) – Section name for results
parameters.fmt_options (dict) – The format options used to refine result groups
parameters.hidden_fields (list) – Hidden metadata fields to return
parameters.hidden_facets (list) – Hidden facet fields to return
parameters.variations_map (dict) – The variations map dictionary to aggregate variations. Please refer to https://docs.constructor.com/reference/shared-variations-mapping for details
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
- get_browse_results_for_item_ids(item_ids, parameters=None, user_parameters=None)
Retrieve browse results from API using item ID’s
- Parameters:
item_ids (list) – Item ID’s of results to get results for
parameters (dict) – Additional parameters to refine result set
parameters.page (int) – The page number of the results
parameters.results_per_page (int) – The number of results per page to return
parameters.filters (dict) – Filters used to refine results
parameters.sort_by (str) – The sort method for results
parameters.sort_order (str) – The sort order for results
parameters.section (str) – Section name for results
parameters.fmt_options (dict) – The format options used to refine result groups
parameters.hidden_fields (list) – Hidden metadata fields to return
parameters.hidden_facets (list) – Hidden facet fields to return
parameters.variations_map (dict) – The variations map dictionary to aggregate variations. Please refer to https://docs.constructor.com/reference/shared-variations-mapping for details
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
constructor_io.modules.catalog module
Catalog Module
- class constructor_io.modules.catalog.Catalog(options)
Bases:
objectCatalog Class
- create_item_groups(parameters=None)
Create new item groups. If the item groups already exist, they will be skipped.
- Parameters:
parameters.item_groups (list) – A list of item groups to create
parameters.section (str) – The section to update
- create_or_replace_item_groups(parameters=None)
Create or replace item groups. If the item groups already exist, they will be updated. If not, they will be created. Existing item groups not sent in the request will be deleted.
- Parameters:
parameters.item_groups (list) – A list of item groups to create or replace
parameters.section (str) – The section to update
- create_or_replace_items(parameters=None)
Add multiple items to index whilst replacing existing ones (limit of 1,000)
- Parameters:
parameters.items (list) – A list of items with the same attributes as defined in https://docs.constructor.com/reference/catalog-items
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the update even if it will invalidate a large number of existing items
- create_or_replace_variations(parameters=None)
Add multiple variations to index whilst replacing existing ones (limit of 1,000)
- Parameters:
parameters.variations (list) – A list of variations with the same attributes as defined in https://docs.constructor.com/reference/catalog-variations
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the update even if it will invalidate a large number of existing variations
- create_or_update_item_groups(parameters=None)
Update item groups. If the item groups already exist, they will be updated. If not, they will be created.
- Parameters:
parameters.item_groups (list) – A list of item groups to create or update
parameters.section (str) – The section to update
- delete_item_groups(parameters=None)
Delete all item groups.
- Parameters:
parameters.section (str) – The section to delete from
- delete_items(parameters=None)
Delete multiple items from the index (limit of 1,000)
- Parameters:
parameters.items (list) – A list of items with the same attributes as defined in https://docs.constructor.com/reference/catalog-items (only IDs are required)
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the update even if it will invalidate a large number of existing items
- delete_variations(parameters=None)
Delete multiple variations from the index (limit of 1,000)
- Parameters:
parameters.variations (list) – A list of variations with the same attributes as defined in https://docs.constructor.com/reference/catalog-variations (only IDs are required)
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the update even if it will invalidate a large number of existing variations
- patch_catalog(parameters=None)
Send full catalog files to update the current catalog
- Parameters:
parameters (dict) – Additional parameters for catalog details
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the catalog even if it will invalidate a large number of existing items
parameters.items (file) – The CSV file with all new items
parameters.variations (file) – The CSV file with all new variations
parameters.item_groups (file) – The CSV file with all new item_groups
- replace_catalog(parameters=None)
Send full catalog files to replace the current catalog
- Parameters:
parameters (dict) – Additional parameters for catalog details
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the catalog even if it will invalidate a large number of existing items
parameters.items (file) – The CSV file with all new items
parameters.variations (file) – The CSV file with all new variations
parameters.item_groups (file) – The CSV file with all new item_groups
- retrieve_item_groups(parameters=None)
Retrieve all item groups.
- Parameters:
parameters.section (str) – The section to retrieve from
- retrieve_items(parameters=None)
Retrieves multiple items from the index (limit of 1,000)
- Parameters:
parameters.ids (list) – A list of item IDs to retrieve
parameters.section (str) – The section to retrieve from
parameters.num_results_per_page (int) – The number of items to return. Defaults to 100. Maximum value 100
parameters.page (int) – The page of results to return. Defaults to 1
- retrieve_variations(parameters=None)
Retrieves multiple variations from the index (limit of 1,000)
- Parameters:
parameters.ids (list) – A list of variation IDs to retrieve
parameters.item_id (str) – Item ID of variations to retrieve
parameters.section (str) – The section to retrieve from
parameters.num_results_per_page (int) – The number of variations to return. Defaults to 100. Maximum value 100
parameters.page (int) – The page of results to return. Defaults to 1
- update_catalog(parameters=None)
Send full catalog files to update the current catalog
- Parameters:
parameters (dict) – Additional parameters for catalog details
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the catalog even if it will invalidate a large number of existing items
parameters.items (file) – The CSV file with all new items
parameters.variations (file) – The CSV file with all new variations
parameters.item_groups (file) – The CSV file with all new item_groups
- update_items(parameters=None)
Update multiple items in the index (limit of 1,000)
- Parameters:
parameters.items (list) – A list of items with the same attributes as defined in https://docs.constructor.com/reference/catalog-items
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the update even if it will invalidate a large number of existing items
- update_variations(parameters=None)
Update multiple variations in the index (limit of 1,000)
- Parameters:
parameters.variations (list) – A list of variations with the same attributes as defined in https://docs.constructor.com/reference/catalog-variations
parameters.section (str) – The section to update
parameters.notification_email (str) – An email address to receive an email notification if the task fails
parameters.force (bool) – Process the update even if it will invalidate a large number of existing variations
constructor_io.modules.quizzes module
Quizzes Module
- class constructor_io.modules.quizzes.Quizzes(options)
Bases:
objectQuizzes Class
- get_quiz_next_question(quiz_id, parameters=None, user_parameters=None)
Retrieve next question from API
- Parameters:
quiz_id (str) – Quiz Id
parameters (dict) – Additional parameters to determine next quiz
parameters.answers (list) – 2d Array of quiz answers in the format [[1],[1,2]]
parameters.section (str) – Section for customer’s product catalog
parameters.quiz_version_id (str) – Specific quiz_version_id for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
parameters.quiz_session_id (str) – Specific quiz_session_id for the quiz. Session ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
- get_quiz_results(quiz_id, parameters=None, user_parameters=None)
Retrieve quiz results from API
- Parameters:
quiz_id (str) – Quiz Id
parameters (dict) – Additional parameters to determine next quiz
parameters.answers (list) – 2d Array of quiz answers in the format [[1],[1,2]]
parameters.section (str) – Section for customer’s product catalog
parameters.quiz_version_id (str) – Specific quiz_version_id for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
parameters.quiz_session_id (str) – Specific quiz_session_id for the quiz. Session ID will be returned with the first request and it should be passed with subsequent requests. More information can be found: https://docs.constructor.com/reference/configuration-quizzes
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
constructor_io.modules.recommendations module
Recommendations Module
- class constructor_io.modules.recommendations.Recommendations(options)
Bases:
objectRecommendations Class
- get_recommendation_results(pod_id, parameters=None, user_parameters=None)
Retrieve recommendation results from API
- Parameters:
pod_id (str) – Recommendation pod identifier
parameters (dict) – Additional parameters to refine result set
parameters.num_results (int) – The total number of results to return
parameters.item_ids (str|list) – Item ID(s) to retrieve recommendations for (strategy specific)
parameters.term (str) – The term to use to refine results (strategy specific)
parameters.filters (dict) – Key / value mapping of filters used to refine results
parameters.section (str) – The section to return results from
parameters.variations_map (dict) – The variations map dictionary to aggregate variations. Please refer to https://docs.constructor.com/reference/shared-variations-mapping for details
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
constructor_io.modules.search module
Search Module
- class constructor_io.modules.search.Search(options)
Bases:
objectSearch Class
- get_search_results(query, parameters=None, user_parameters=None)
Retrieve search results from API
- Parameters:
query (str) – Search query
parameters (dict) – Additional parameters to refine result set
parameters.page (int) – The page number of the results
parameters.results_per_page (int) – The number of results per page to return
parameters.filters (dict) – Filters used to refine search
parameters.sort_by (str) – The sort method for results
parameters.sort_order (str) – The sort order for results
parameters.section (str) – Section name for results
parameters.fmt_options (dict) – The format options used to refine result groups
parameters.hidden_fields (list) – Hidden metadata fields to return
parameters.hidden_facets (list) – Hidden facet fields to return
parameters.variations_map (dict) – The variations map dictionary to aggregate variations. Please refer to https://docs.constructor.com/reference/shared-variations-mapping for details
user_parameters (dict) – Parameters relevant to the user request
user_parameters.session_id (int) – Session ID, utilized to personalize results
user_parameters.client_id (str) – Client ID, utilized to personalize results
user_parameters.user_id (str) – User ID, utilized to personalize results
user_parameters.segments (str) – User segments
user_parameters.test_cells (dict) – User test cells
user_parameters.user_ip (str) – Origin user IP, from client
user_parameters.user_agent (str) – Origin user agent, from client
- Returns:
dict
constructor_io.modules.tasks module
Tasks Module
- class constructor_io.modules.tasks.Tasks(options)
Bases:
objectTasks Class
- get_all_tasks(parameters=None)
Retrieve tasks from API
- Parameters:
parameters (dict) – Additional parameters for task details
parameters.page (int) – The page number of the results
parameters.start_date (string) – The start date of results to return - YYYY-MM-DD
parameters.end_date (string) – The end date of results to return - YYYY-MM-DD
parameters.status (string) – The status of tasks to return - ‘QUEUED’, ‘IN_PROGRESS’, ‘DONE’, ‘FAILED’, ‘CANCELED’
parameters.type (string) – The type of tasks to return - ‘ingestion’, ‘user_data_request’
parameters.results_per_page (int) – The number of results per page to return
- Returns:
dict
- get_task(task_id)
Retrieve specific task from API
- Parameters:
task_id (int) – The id of the task to retrieve
- Returns:
dict