Some Frequently Asked Question
I'd like to create a prospect rather than a client
Set the type to 'P' when persisting a FidelityMember
{
"FidelityMember":{
"name":"Doe",
"mobile":"+33664208629",
"type":"P"
}
}
I just persist a member with a mobile, and do not get it back on a search query...
The Platform automatically store phone number according to the Int. telecom Std. You probably are making a search only with the local number (without international prefix). You can circumvent this by using the contains operator.
Exemple with french mobile phone : you store 060102030405, it becomes +3360102030405. So below in the example we search on the 60102030405 part.
{
"CompactFidelityMember":{
"name":"Doe",
"mobile_contains":"60102030405"
}
}
Can I get only the Member info, without all the events ?
Sure ! We have a simplified object for that : CompactFidelityMember
BTW, this is now the default behavior (since 07/2020) to avoid oversized output. So even on FidelityMember GET you will not have the events embeded.
But there is other sub-objects that can be of a unknown size and in many cases it is recommended to get a "CompactFidelityMember" instead of a "FidelityMember" performance wise.
{
"CompactFidelityMember":{
"name":"Doe",
"mobile_contains":"664208629"
}
}
Can I get all the event of a member of a given type ?
Request to "Show" all the events such that event=xxx (addPoint in the example)
{
"AdEvent" : {
"type":"addPoint",
"member" : {"id": "here the member id"}
}
}
If you are interested only in coupons/messages use the Sent object (which is a subclass of AdEvent)
{
"Sent" : {
"member" : {"id": "here the member id"}
}
}
Can I get more debug info ?
If feel that the error is not verbose enought, you may try the following parameter addition to the url to have the error stacktrace :
printStackTrace=true
hence the complete url will be :
https://{server}/apiv1/webapi.do?printStackTrace=true&json_header={...}&json_data={}
Can I only check that the data exist without getting all the verbose output
By default a GET or POST will return the data requested.
There is at least three ways to only check the data exist :
- add the parameter
action=search
to your query. The output will be ok with the id of the object of the 3008 error, no data found. The default value of action is "show". - use the count feature. add the parameter
action=count
to your query. - use the fields feature. we recommend returning the id or idExternal based on your needs :
fields=id
. Here again, The output will be ok with the id of the object of the 3008 error, no data found
JSon api is overkill, I use csv file instead
Guess what, you are not the first one to say that. Ok, follow this link, lots of wonders await you :
CSV import process.
To sum it up, if you are able to produce a CSV file and put the property name as column header, you'll be able to upload a batch of create and update request on the api.
I do not trust my connection, how can I check you are reachable
It is indeed a good pattern to monitor your external ressources. We provide a heartbeat url that check if the servel is alive and respoding without overloading it.
https://{server_name}/loyaltyoperator/isup.do
- the test environement server_name is qa.adelya.com
- the production environement server_name is asp.adelya.com
How can I cancel an event (Sale, coupon, etc...)
The general answer is: issue an HTTP DELETE request on you object (with an id or using identifier field). eg:
HTTP DELETE
{
"AdEvent":{
"idExternal":"427583854679"
}
}
This will set status1=1 and set the dateStatus1 to now.
But in some cases, especially for money related events, you do not want that an event disappears from your list and reports, you would prefer to create a sibling negative event.
Eg. for an {AdEvent :{"type":"addCA","fvalue":100}
you will persist a {AdEvent :{"type":"addCA, "fvalue":-100}}
I run a DELETE, but my data is still there
There is no explicit delete on our platform.
All objects have many inter relations, and it is not usually possible to just delete an object. More over for history searches and legal aspects, we must be able to track who has done what, and what was done or sent via our platform to a customer. Deleting en object would conflict with this need.
Instead of deleting an object, you should consider setting the archive
property to true and dateValidUntil
to the date of termination (if those properties exist of course...)
If you think nevertheless that an object must be deleted, please send a message to our support.
Example :
Create a test member
AUTH="yourauth here : apikye;user:tokenorpass"
$ curl -u $AUTH -X PUT --data 'json_data={"FidelityMember":{"name":"testdoc"}}' 'https://qa.adelya.com/apiv1/webapi.do'
{"ApiReturn":{"code":"OK","message":"","id":"500038902"}}
Call delete on the id returned
$ curl -u $AUTH -X DELETE --data 'json_data={"FidelityMember":{"id":500038902}}' 'https://qa.adelya.com/apiv1/webapi.do'
{"ApiReturn":{"code":"OK","message":"","id":"500038902"}}
check activity level (must be 0) :
curl -u $AUTH --data 'json_data={"FidelityMember":{"id":500038902}}' 'https://qa.adelya.com/apiv1/webapi.do?fields=actif'
{"FidelityMember":{"actif":0,"id":500038902}}
Do idExternal must be unique ?
Lot's (most of) our business object have an idExternal for you to store you unique key, and then use this in query. We highly recommend that this key is a unique one but we do not enforce this. So it's your responsability. If it is not unique, you'll not be able to use it with the loadFromKeys operator. This may change in future version but for now it's your job.
Some cUrl examples please
curl --user '{APIKEY};{user}:{pass}' 'https://qa.adelya.com/apiv1/webapi.do?json_data=%22FidelityMember%22%3A%7B%22name_starts_with%22%3A%22John%22%7D%7D'
Note : as parameters are in url they MUST be URLEncoded !
curl --user '{APIKEY};{user}:{pass}' --data 'json_data={"FidelityMember":{"name_starts_with":"John"}}' -X POST 'https://qa.adelya.com/apiv1/webapi.do'
curl --user '{APIKEY};{user}:{pass}' --data "@json.post" -X POST 'https://qa.adelya.com/apiv1/webapi.do'
with an existing local file
json.post
containing :
{ "FidelityMember":{ "name_starts_with":"John" } }Note : a body file containing also the parameter name is acceptable if you want to pass more than one parameter in the body (they could be part of the url) ex :
dateformat=iso8601&json_data={...}
I'd like to count the number of xxx
Yes you can, proceed as for a search, but add the parameter action=count to your request.
curl example : curl --user '{APIKEY};{user}:{pass}' --data 'action=count&format=JSON&json_data={"FidelityMember":{"name_starts_with":"test"}}'https://qa.adelya.com/apiv1/webapi.do
return is {"ApiReturn":{"code":"OK","message":"107"}}
I set a validity period on an object but another time is saved
Check if you set a full datetime format : for a validity period it can lead to a time shifting. Ensure the fields are set with format 'YYYY-MM-dd'
The server will automatically save "DateStart 00:00:00" and "DateEnd 23:59:59". Be aware that it's saved with the server timezone.
Ok, sometimes everything do not work at first try. Drop us an email : support_at_adelya_dot_com.