AlgoliaSearch\Index::getObject PHP Method

getObject() public method

Get an object from this index.
public getObject ( $objectID, $attributesToRetrieve = null ) : mixed
$objectID the unique identifier of the object to retrieve
$attributesToRetrieve (optional) if set, contains the list of attributes to retrieve as a string separated by ","
return mixed
    public function getObject($objectID, $attributesToRetrieve = null)
    {
        $id = urlencode($objectID);
        if ($attributesToRetrieve === null) {
            return $this->client->request($this->context, 'GET', '/1/indexes/' . $this->urlIndexName . '/' . $id, null, null, $this->context->readHostsArray, $this->context->connectTimeout, $this->context->readTimeout);
        }
        return $this->client->request($this->context, 'GET', '/1/indexes/' . $this->urlIndexName . '/' . $id, array('attributes' => $attributesToRetrieve), null, $this->context->readHostsArray, $this->context->connectTimeout, $this->context->readTimeout);
    }