Skip to main content
GET
/
1
/
indexes
/
{indexName}
/
{model}
/
recommend
/
rules
/
{objectID}
curl
curl --request GET \
  --url https://algolia_application_id.algolia.net/1/indexes/ALGOLIA_INDEX_NAME/related-products/recommend/rules/test-record-123 \
  --header 'accept: application/json' \
  --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
  --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID'
{
  "_metadata": {
    "lastUpdate": "2023-07-04T12:49:15Z"
  },
  "objectID": "<string>",
  "condition": {
    "filters": "(category:Book OR category:Ebook) AND _tags:published",
    "context": "mobile"
  },
  "consequence": {
    "hide": [
      {
        "objectID": "test-record-123"
      }
    ],
    "promote": [
      {
        "objectID": "test-record-123",
        "position": 1
      }
    ],
    "params": {
      "automaticFacetFilters": [
        {
          "facet": "<string>",
          "negative": true
        }
      ],
      "filters": "(category:Book OR category:Ebook) AND _tags:published",
      "optionalFilters": [
        "category:books<score=1>",
        "category:-movies<score=1>"
      ]
    }
  },
  "description": "Boost on-sale items",
  "enabled": true,
  "validity": [
    {
      "from": 123,
      "until": 123
    }
  ]
}
Required ACL: settings

Authorizations

x-algolia-application-id
string
header
required

Your Algolia application ID.

x-algolia-api-key
string
header
required

Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.

Path Parameters

indexName
string
required

Name of the index on which to perform the operation.

Example:

"ALGOLIA_INDEX_NAME"

model
enum<string>
required
Available options:
related-products,
bought-together,
trending-facets,
trending-items
objectID
string
required

Unique record identifier.

Example:

"test-record-123"

Response

OK

Recommend rule.

_metadata
object

Rule metadata.

objectID
string

Unique identifier of a rule object.

condition
object

Condition that triggers the rule. If not specified, the rule is triggered for all recommendations.

consequence
object

Effect of the rule.

description
string

Description of the rule's purpose. This can be helpful for display in the Algolia dashboard.

Example:

"Boost on-sale items"

enabled
boolean
default:true

Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time.

validity
object[]

Time periods when the rule is active.

I