The API client methods accept additional parameters for adding headers or query parameters.

For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'algolia'

client = Algolia::SearchClient.create(
    "ALGOLIA_APPLICATION_ID",
    "ALGOLIA_API_KEY",
)

client.search_single_index(
  "ALGOLIA_INDEX_NAME",
  { query: "SEARCH_QUERY" },
  # Add a custom HTTP header to this request
  header_params: { "extra-header": "greetings" }, 
  # Add query parameters to this request
  query_params: { queryParam: "value" }
)

Reference

header_params
type: Hash[String,String]

Additional headers as key-value pairs to send with this request.

query_params
type: Hash[String,Any]

Additional query parameters to send with this request. They only take effect with API operations that support query parameters. Otherwise, they’re ignored.

Did you find this page helpful?
Ruby API clients v3