Use hidden filters

In Tweakwise, you’re able to pass hidden filters to almost every request that returns products (see the API reference for the calls). These filters are used to pre-filter the result set without the need to configure a facet in your filter template.

This functionality is useful for pages where you want to show a default subset of products:

  • Include: brand pages, specific categories.
  • Exclude: show regular catalog except specificly marked products

Include

Use tn_parameters to only include products that match with the given attribute value(s).

Example: use this if you can't exclude items in your Tweakwise feed, e.g. only items that are in-stock:

Search

Use tn_parameters in /navigation-search to include products matching selection criteria.

Example: select only items that are in-stock:

/navigation-search/c1a12e92/?tn_parameters=in-stock%3Dtrue

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/navigation-search/c1a12e92?tn_cid=1000&tn_parameters=in-stock%3Dtrue' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Example: filter by brand 'Coca Cola' or 'Pepsi':

/navigation-search/c1a12e92/?tn_parameters=brand%3DCoca%20Cola%26brand%3DPepsi

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/navigation-search/c1a12e92?tn_cid=1000&tn_parameters=brand%3DCoca%20Cola%26brand%3DPepsi' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Merchandising

Use tn_parameters in /navigation to include products matching selection criteria.

Example: select only items that are in-stock:

/navigation/c1a12e92/?tn_parameters=in-stock%3Dtrue

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/navigation/c1a12e92?tn_cid=1000&tn_parameters=in-stock%3Dtrue' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Example: filter by brand 'Coca Cola' or 'Pepsi':

/navigation/c1a12e92/?tn_parameters=brand%3DCoca%20Cola%26brand%3DPepsi

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/navigation/c1a12e92?tn_cid=1000&tn_parameters=brand%3DCoca%20Cola%26brand%3DPepsi' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Suggestions

Use tn_parameters in /suggestions and /suggestions/products to include products matching selection criteria.

Example: select only items that are in-stock:

/suggestions/c1a12e92/?tn_parameters=in-stock%3Dtrue

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/suggestions/c1a12e92?tn_q=hoodie&tn_cid=1000&tn_parameters=in-stock%3Dtrue' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Exclude

Use tn_parameters_except to exclude items with the given attribute value(s).

Example: use this if you can't exclude items in your Tweakwise feed, e.g. for displaying a specific catalog for a user group.

Search

Use tn_parameters_except in /navigation-search to exclude products matching selection criteria.

Example: select all items that are not in segment 'basic':

/navigation-search/c1a12e92/?tn_parameters_except=segment%3Dbasic

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/navigation-search/c1a12e92?tn_cid=1000&tn_parameters_except=segment%3Dbasic' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Merchandising

Use tn_parameters_except in /navigation to exclude products matching selection criteria.

Example: select all items that are not in segment 'basic':

/navigation/c1a12e92/?tn_parameters_except=segment%3Dbasic

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/navigation/c1a12e92?tn_cid=1000&tn_parameters_except=segment%3Dbasic' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Suggestions

Use tn_parameters_except in /suggestions and /suggestions/products to exclude products matching selection criteria.

Example: select all items that are not in segment 'basic':

/suggestions/c1a12e92/?tn_parameters_except=segment%3Dbasic

curl --request GET \
     --url 'https://gateway.tweakwisenavigator.com/suggestions/c1a12e92?tn_q=hoodie&tn_cid=1000&tn_parameters_except=segment%3Dbasic' \
     --header 'TWN-Source: Tweakwise API docs' \
     --header 'accept: application/json'

Good to know

  • Use the attribute URL name as the parameter names.
  • Reach out to our support team, and we'll help mark the attributes you'd like to use as hidden filters in your instance.
  • When using multiple attributes, format it like a regular URL querystring and URL encode the entire value:
    'in-stock%3Dtrue%26vip%3Dtrue';