addObjects giving a fatal error when pushing data to algolia code example

Example 1: addObjects giving a fatal error when pushing data to algolia

$index->saveObjects(array objects, [
  "autoGenerateObjectIDIfNotExist" => boolean
  // any other requestOptions
]

// add a single object
$index->saveObject(array object, [
  "autoGenerateObjectIDIfNotExist" => boolean
  // any other requestOptions
]

Example 2: addObjects giving a fatal error when pushing data to algolia

$res = $index->saveObjects(
  [
    [
      'firstname' => 'Jimmie',
      'lastname'  => 'Barninger'
    ],
    [
      'firstname' => 'Warren',
      'lastname'  => 'Speach'
    ]
  ],
  [
    'autoGenerateObjectIDIfNotExist' => true
  ]
);

Example 3: addObjects giving a fatal error when pushing data to algolia

{
  "objectIDs": [
    "myObjectID1",
    "myObjectID2"
  ],
  "taskID": 678,
}

Example 4: addObjects giving a fatal error when pushing data to algolia

{
  "objectID": "myObjectID1",
  "taskID": 678,
}

Example 5: addObjects giving a fatal error when pushing data to algolia

index = Algolia::Index.new "YourIndex"
MyActiveRecordModel.find_in_batches(1000) do |objects|
  index.add_objects(objects)
end
# that's actually what `MyActiveRecordModel.reindex!` does

mysql_connect('localhost', 'mysql_user', 'mysql_password');
mysql_set_charset('utf8');
$limit = 1000;
$start = 0;
$index = $client->initIndex('YourIndexName');
while (true) {
  $q = mysql_query("SELECT * FROM YourTable LIMIT " . $start . "," . $limit);
  $n = 0;
  if ($q) {
    $objects = array();
    while(($row = mysql_fetch_assoc($q))) {
      array_push($objects, $row);
      ++$n;
    }
    $index->addObjects($objects);
  }
  if ($n != $limit) {
    break;
  }
  $start += $n;
}

Example 6: addObjects giving a fatal error when pushing data to algolia

$index->saveObjects(
  [
    [
      'objectID' => 'myID1',
      'firstname' => 'Jimmie',
      'lastname'  => 'Barninger'
    ],
    [
      'objectID' => 'myID2',
      'firstname' => 'Warren',
      'lastname'  => 'Speach'
    ]
  ]
);

Example 7: addObjects giving a fatal error when pushing data to algolia

$index->saveObject(
  [
    'objectID' => 'myID',
    'firstname' => 'Jimmie',
    'lastname'  => 'Barninger'
  ]
);

Example 8: addObjects giving a fatal error when pushing data to algolia

$objects = [/* objects */];

$res = $index->saveObjects($objects, [
  'autoGenerateObjectIDIfNotExist' => true,
  'X-Forwarded-For' => '94.228.178.246'
]);