Operators

Simple Operators

For filtered queries you can add conditions on your properties.

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

			"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) :

HTTP PUT

json_data={"FidelityMember":{"mobile":"+33613071724","loadFromKeys":{"idExternal":"my_CRM_Key"}}}
			
HTTP PUT

<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"
					}
				}
			}