Querying Orion with metadata value of String type

I am trying to query Orion, version 2.2.0-next, so to return records matching metadata value of different strings.

My JSON looks like this:

"AttributeName": {
        "type": "String",
        "value": "Some Value",
        "metadata": {
            "AttributeMeta": {
                "type": "String",
                "value": "Some Other Value"
            }
        }
    }

I am querying Orion as follows: http://myip:1026/v2/entities?type=myType&mq=AttributeName.AttributeMeta==Some%20Other%20Value&options=count

Unfortunately, the return is empty.

Any ideas, suggestions?

EDIT:

Entity creation code in PHP:

$data[] = array("id" => (mktime() + $i)."_$client", "type" => "myType", "datetime" => array("type" => "DateTime", "value" => date("Y-m-d\TH:i:s", mktime($ho, $mi, $se, $mo, $da, $ye))), "Parameter1" => array("type" => "String", "value" => (string)$parameter1), "Parameter2" => array("type" => "Float", "value" => (float)$Parameter2), "Parameter3" => array("type" => "String", "value" => (string)$parameter3, "metadata" => array("Parameter3Meta" => array("type" => "String", "value" => "$parameter3meta"))), "location" => array("type" => "geo:point", "value" => "$lat, $lon"), "range" => array("type" => "Float", "value" => (float)$range), "Parameter4" => array("type" => "String", "value" => (string)$parameter4)); 
curl_setopt($ch, CURLOPT_URL, "http://$ip/v2/entities");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data[$i]));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("fiware-service: $tenant", "fiware-servicepath: /$subtenant", "Content-Type: application/json"));
curl_setopt($ch, CURLOPT_PORT, 1026);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); 
curl_setopt($ch, CURLOPT_TIMEOUT, 400);
$response = curl_exec($ch);

EDIT 2: In the above query two headers are used: fiware-service: tenant and fiware-servicepath: /subtenant

Upvotes: 1

Views: 119

Answers (1)

kzangeli
kzangeli

Reputation: 448

Try removing 'type=myType'. It's not clear what's the type of the entity you are trying to extract with the query.

Upvotes: 1

Related Questions