I'm trying to add a node to the index spatial.
$path = '/db/data/index/node/'.$layer;
$nodePath = DbConfig::getFullDatabaseServerUrl() . '/db/data/node/' . $nodeId;
$data = array("key" => "dummy", "value" => "dummy","uri"=>$nodePath);
$data =json_encode($data);
DbRestManager::send($path,$data);
public static function send($path, $data) {
$url = DbConfig::getFullDatabaseServerUrl() . $path;
$auth=DbConfig::getUserName().':'.DbConfig::getPassword();
$authEcoded=base64_encode($auth);
$headers = array('Accept: application/json; charset=UTF-8','Authorization: Basic '.$authEcoded,'Content-Type: application/json');
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Execute post
$result = curl_exec($ch);
// Close connection
curl_close($ch);
}
$data={"key":"dummy","value":"dummy","uri":"dev_db.pico-app.com:7473/db/data/node/11"}
Everything seems fine, but the operation doesn't work.For some reason i also can't see error.
From the spatial server documentation, adding node to an index has a complete different json payload to send, and to a different endpoint.
You'll have first to create a spatial layer, then create a spatial index and then only add your node to the spatial index.
Instead of using curl in raw, you may want to use neoclient and the spatial extension for it that will remove you all the burden of the http requests and provide useful methdods, a simple example: