Operators
Simple Operators
For filtered queries you can add conditions on your properties.
- equals : default no need of operator
- not : attribute must not be the given value (value must be at least 1 char long)
- contains : attribute must contains the given value (value must be at least 1 char long)
- starts_with : attribute must starts with the given value (value must be at least 1 char long)
- is_null : attribut must be null (a value is expected by the parser, but not used ,e.g :
"name_is_null":"true"
) - is_not_null : attribut must not be null (a value is expected by the parser, but not used ,e.g :
"name_is_not_null":"true"
) - ge : greater or equal, for date or numeric attribut
- gt : greater than, for date or numeric attribut
- le : lesser or equal than, for date or numeric attribut
- lt : lesser than, for date or numeric attribut
- in : attribute must be one of the given values (separated by commas)
- not_in : attribute must not be one of the given values (separated by commas)
- near : proximity of a latitude or longitude, the second argument is to specify an inteval width. Notation is
position:precision
, where precision is a double (default is 1.0). e.g."clat_near":"48.8:0.25"
Disjonctive : OR
you can add one (or several) OR node in your query
"or" :{
"attribut1_operator1":"value1",
"attribut1_operator1":"value2"
}
<or>
<attribut1_operator1>value1</attribut1_operator1>
<attribut1_operator1>value2</attribut1_operator1>
</or>
"or":[
{
"attribut1_operator1":"value1",
"attribut1_operator1":"value2"
},
{
"attribut2_operator1":"value3",
"attribut2_operator1":"value4"
}
]
the magic loadfromkeys operator
In some case storing Adelya member or event id is not possible or just boring.
we offer a mecanism that will help you dealing with your own primary key, using the loadFromKey keyword. Instead of using {id:xyz}, use loadFromKeys: { attribute: "value"}
Exemple : modification of the mobile phone of a member for whom you have you own system key store in idExternal (stored at creation time) :
json_data={"FidelityMember":{"mobile":"+33613071724","loadFromKeys":{"idExternal":"my_CRM_Key"}}}
<FidelityMember>
<mobile>+33613071724</mobile>
<loadFromKeys>
<idExternal>my_CRM_Key</idExternal>
</loadFromKeys>
</FidelityMember>
Note 1. this approach is compatible with composite key, just specify more than one attribute/value conditions.
Note 2. this approach is only for PUT request, there is no need for searching as you can directly use the field in research.
Note 3. for security reasons, we do not permit to update an existing reference. This means that you can safely used this operators on object creation, but on object update it will fails silently.
Note 4. If your composite/external key is not unique, It will raise a "non unique result found".
Example : store a sales made at a specific shop by a member knowing it's cardnumber
{
"AdEvent":{
"type":"addCA",
"fvalue":120,
"group" : {
loadFromKeys: { idExternal: "here the shop idExternal"}
},
member: {
loadFromKeys: { cardnumber: "124220747"}
}
}
}
Full example
Example: Search member named doe whose mobile contains 664208629 or email is joe.doe@adelya.com , create after January the 1st 2013, having exactly 5 points, and postal address is near (48.8,2.35) +/- 3°
{
"CompactFidelityMember":{
"name":"Doe",
"firstname_is_not_null": "1",
"or" :{
"mobile_contains":"664208628",
"email":"joe.doe@adelya.com"
},
"dateCreate_ge":"2013-01-01",
"nbPoint":5,
"address":{
"clat_near":"48.8:3",
"clong_near":"2.35:3"
}
}
}