FOR WEB DEVELOPERS
It is very easy to use PointLoyalty REST API.
Accessing the above URL will return to you all active loyalty offers registered in the system for demonstration purposes. Note that SSL connections are also supported - just specify https protocol in every request.
Common description
PointLoyalty Manager has API for integration with third-party systems using Web Services and REST.For integration with bonus calculation system one need to follow these steps:
- Run PointLoyalty Manager and register in the system.
- Set up the application according to your rules of charging bonus points - define a relevant set of customer actions, define customer attributes which can impact bonus points calculation, define categories of your goods and services.
- Create loyalty offers - under what conditions and for which customer actions you plan to award them with bonus points.
- The system is ready to process transactions of your customers.
DETAILED DESCRIPTION OF POINTLOYALTY REST API
For doing integration using REST API take a look at DETAILED DESCRIPTION.REST API EXAMPLE
Example of bonus points processing
Let you have a loyalty program with the following offer:"All users who performed action buy with action attribute sum having value more then 1000 - will get a bonus equal to 5% from sum field value".
request = new XMLHttpRequest();
request.open("POST", "http://pointloyalty.com/wl/rest/demo" , true);
var params = "login=" + JSON.stringify(loginObj) + "&actions=" + JSON.stringify(actionsObj) + "&!method=GET";
request.setRequestHeader("Content-length", params.length);
request.setRequestHeader("Connection", "close");
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.onreadystatechange = function() {
// ...process the result here
};
request.send(params);
REST API takes parameters in JSON format. Here is the sample JSON object in JavaScript:
request.open("POST", "http://pointloyalty.com/wl/rest/demo" , true);
var params = "login=" + JSON.stringify(loginObj) + "&actions=" + JSON.stringify(actionsObj) + "&!method=GET";
request.setRequestHeader("Content-length", params.length);
request.setRequestHeader("Connection", "close");
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.onreadystatechange = function() {
// ...process the result here
};
request.send(params);
var actionsObj = { memberId : Smith, name : buy,
values : [
{ name: sum,
numericValue : 1100 }
]
}
Try to make the same call from your browser: values : [
{ name: sum,
numericValue : 1100 }
]
}
http://www.pointloyalty.com/wl/rest/demo?login={name:demo,password:demo}&actions={name:buy, memberId:Smith, values:[{name:sum, numericValue:1100}]}&!output-type=XML
INTEGRATION
Server side integration
The easiest integration way - integration on the server side. We provide client libraries for the following platforms:- Java - Java REST client library. See also an example.
- PHP - REST client library for PHP.
You can develop your own toolkit for accessing PointLoyalty REST services (see DETAILED DESCRIPTION) for the programming language of your choice.
Client side integration
Since XMLHttpRequest restricts cross-domain access the integration happens on web server side. One of the ways to do the integration is to use proxy-service on your server. Depending on the platform you use there are following options available:Tomcat/JBoss (Java web server)
Deploy the following servlet on your server and direct all your REST requests to this servlet.The servlet will redirect all requests to REST resources of PointLoyalty server.
PHP
If you are using PHP, take one of the following proxy scripts.ASP
If your server is Microsoft IIS, take the first script from this page.Your REST query will look like:
http://yourserver.com/proxy.asp?url=<url_encoded_desitnation_url>[&mimeType=<mimeType>]
SUPPORT
Pay attention that the system has a member console to keep customers informed about bonus points they earn.On all issues regarding integration please consult our technical support service - support@pointloyalty.ru





