Aritic Loyalty API Doc
Welcome to the Aritic Layalty API documentation! To simplify a developer's work, we at Aritic PinPoint have built developer-friendly APIs which are supported by the major programming languages to interact with your PinPoint instance.
This feature gives businesses the power to create engaging programs that generate customer loyalty and increase sales. Through this Platform, you can easily manage the rewards and loyalty points to be provided to your customers. Thereafter, the customers can earn or redeem the points as per the rules defined by you.
We have language bindings for PHP, Java, Shell, Ruby and Python! You can view code examples on the right side of this page and use the top right tabs to switch between different programming languages.
Our APIs work over the HTTP protocol with JSON and build in an RPC-like manner, and you can do anything with the API's using their particular action provided. All the HTTP requests must be made over HTTPS URL given in the action defined in this documentation. All responses you receive from the API will return in JSON.
Requests should be made using the POST method with any parameters encoded as JSON in the body of the request.
Authorization
Aritic uses OAuth or Basic Authentication for API authorization. It supports both OAuth 1a and OAuth 2. The administrator of the Aritic instance must choose one or the other. Of course OAuth 2 is only recommended for servers secured behind SSL. Basic authentication must be enabled in Configuration -> API Settings.
The Aritic administrator should enable the API in the Configuration -> API Settings. This will add the “API Credentials” to the admin menu. A client/consumer ID and secret should then be generated which will be used in the following processes.
All authorization requests should be made to the specific Aritic instances URL, i.e. https://yourapp.aritic.com.
Basic Authentication Key
$echo "username password" | base64
Output : qwertEBkYXRhYWVnaXMuY29tOmFydWxqwert
<?php
echo base64_encode("username:password");
?>
byte[] encodedBytes = Base64.encodeBase64("username:password".getBytes());
System.out.println("encodedBytes " + new String(encodedBytes));
To authenticate with Aritic PinPoint you must have a valid Aritic PinPoint authorization key.To generate authorization key you need to have an Aritic PinPoint account, in case you don't have an account, please use the following link for Registration .
Once you have an account with Aritic PinPoint, you can use various code snippets on the right panel to create your authorization key and please follow the steps provided in this video tutorial.
Aritic PinPoint expects for the authorization key to be included in all API requests to the server in a header that looks like the following:
"'authorization: Basic qwertEBkYXRhYWVnaXMuY29tOmFydWxqwert'"
73,1 0%
OAUTH 1A
The OAuth 1a method is recommended for servers that are not behind https. Note that OAuth 1a access tokens do not expire.
OAuth 1a can be a complicated method due to the need to generate a signature for the request. If anything is off with the signature, the request will not be validated.
Authorization
Step One - Obtain a Request Token
The first step is to obtain a request token that will be used when directing the user to the authorization page.
Make a POST to the request token endpoint /oauth/v1/request_token
:
POST /oauth/v1/request_token
Authorization:
OAuth oauth_callback="https%3A%2F%2Fyour-callback-uri.com",
oauth_consumer_key="CONSUMER_KEY",
oauth_nonce="UNIQUE_STRING",
oauth_signature="GENERATED_REQUEST_SIGNATURE",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1318467427",
oauth_version="1.0"
(note that the header has been wrapped for legibility)
Review Generating the Authorization Header on the specifics of generating the OAuth header.
The response will be a query string:
oauth_token=REQUEST_TOKEN&oauth_token_secret=REQUEST_TOKEN_SECRET&oauth_expires_in=3600
Parse the string and use the parameters in the next step as indicated.
Note that the refresh token is only good for the number of seconds specified in oauth_expires_in
.
Step Two - Authorization
Now redirect the user to the authorization endpoint oauth/v1/authorize
with the request token as part of the URL’s query.
If the callback is something different than what is configured in Aritic, url encode it and include in the query as oauth_callback
.
/oauth/v1/authorize?oauth_token=REQUEST_TOKEN&oauth_callback=https%3A%2F%2Fyour-callback-uri.com
The user will login and Aritic will redirect back to the either the consumer’s configured callback or to the oauth_callback
included in the query.
The callback will include oauth_token
and oauth_verifier
in the URL’s query.
Compare the oauth_token
in the query with that obtained in step two to ensure they are the same and prevent cross-site request forgery.
oauth_verifier
will need to be part of the header generated in step three.
Step Three - Obtain an Access Token
Generate the Authorization header and make a POST to the access token endpoint /oauth/v1/access_token
.
When generating the header, the oauth_token_secret
returned in step two should be used as the TOKEN_SECRET
in the composite key.
oauth_verifier
from step two should be part of the Authorization header generated.
(note that the header has been wrapped for legibility)
The response should include a query string with the access token:
oauth_token=ACCESS_TOKEN&oauth_token_secret=ACCESS_TOKEN_SECRET
The oauth_token
can be included in the authorize header and the oauth_token_secret
should be used as the TOKEN_SECRET
in the composite key when signing API requests.
Generating the Authorization Header
The OAuth header may include the following parameters:
Key | Description |
---|---|
oauth_callback | Optional, URL encoded callback to redirect the user to after authorization. If the callback URL is set in Aritic, this must match. |
oauth_consumer_key | The consumer key obtained from Aritic’s API Credentials |
oauth_nonce | Uniquely generated string that should be used only once |
oauth_signature | Signature generated from all applicable data for the request |
oauth_signature_method | Method for creating the signature. Currently, only HMAC-SHA1 is supported. |
oauth_timestamp | Current unix timestamp |
oauth_token | The access token |
oauth_verifier | Returned after authorization and used when requesting an access token |
oauth_version | Should always be 1.0 |
Step One - Build the Base String
The base string is used to generate the oauth_signature.
The structure of the base string is as follows:
METHOD&URL_ENCODED_URI&NORMALIZED_PARAMETERS
METHOD
should be the request method and should always be capitalized.
URL_ENCODED_URI
should be the base URI the request is made to. It should not include any query parameters (query parameters should be part of NORMALIZED_PARAMETERS).
NORMALIZED_PARAMETERS
should be a url encoded, alphabetically sorted query string of the above oauth parameters (except oauth_signature
) plus the parameters of the request (query/post body).
Each key and each value of the parameters must be url encoded individually as well.
Then each url encoded key/value pair should be concatenated into a single string with an ampersand (&) as the glue character.
For example, let’s say a request includes a query of 'title=Mr&firstname=Joe&lastname=Smith'. The process would look something like the following (replacing urlencode()
with whatever function is appropriate for the language being used). Of course realistically, natural sort and loop functions would be used.
Put all together, a base string might look like:
Step Two - Build the Composite Key
The composite key is used to encrypt the base string. It is composed of the consumer secret and the token secret if available (post authorization) combined with an ampersand (&).
If the token secret is not available, i.e. during the request token process, then an ampersand (&) should still be used.
Step Three - Generate the Signature
Now, using the base string and the composite key, the signature can be generated using the appropriate HMAC function available to the language used. The signature generated should then be base64 encoded prior to being used in the Authorization header.
The resulting string should then be used included in the header as oauth_signature
.
Signing the API Request
To sign the API request, generate the Authorization header using the obtained access token.
(note that the header has been wrapped for legibility)
OAUTH 2
Authorization
Step One - Obtain Authorization Code
Redirect the user to the authorize endpoint oauth/v2/authorize
:
(note that the query has been wrapped for legibility)
The user will be prompted to login. Once they do, Aritic will redirect back to the URL specified in redirect_uri with a code appended to the query.
It may look something like: https://your-redirect-uri.com?code=UNIQUE_CODE_STRING&state=UNIQUE_STATE_STRING
The state returned should be compared against the original to ensure nothing has been tampered with.
Step Two - Replace with an Access Token
Obtain the value of the code from Step One then immediately POST it back to the access token endpoint oauth/v2/token
with:
(note that the post body has been wrapped for legibility)
This data should be stored in a secure location and used to authenticate API requests.
Refresh Tokens
The response’s expires_in
is the number of seconds the access token is good for and may differ based on what is configured in Aritic. The code handling the authorization process should generate an expiration timestamp based on that value. For example <?php $expiration = time() + $response['expires_in']; ?>
. If the access token has expired, the refresh_token should be used to obtain a new access token.
The refresh token is by default good for 14 days in which the user will need to reauthorize the application with Aritic. However, the refresh token’s expiration time is configurable through Aritic’s Configuration.
To obtain a new access token, a POST should be made to the access token’s endpoint oauth/v2/token
using the refresh_token
grant type.
(note that the post body has been wrapped for legibility)
The response returned should be a JSON encoded string:
Authenticating the API Request
Authenticating the API request with OAuth2 is easy. Choose one of the following methods that is appropriate for the application’s needs.
Authorization Header
By using an authorization header, any request method can be authenticated.
However, note that this method requires that the server Aritic is installed on passes headers to PHP or has access to the apache_request_headers()
function. apache_request_headers()
is not available to PHP running under fcgi.
Method Specific
The access token can also be appended to the query or included in the body of a POST.
Reward Campaign API
These endpoints will allow you to easily manage Reward Campaigns.
Reedem cashback (admin)
To reedem cashback, you need to call the /api/admin/campaign/cashback/redeem
endpoint with the POST
method.
Definition
POST /api/admin/campaign/cashback/redeem
curl https://localhost:8181/api/admin/campaign/cashback/redeem \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customerId=6102cef9-d263-46de-974d-ad2e89f6e81d" \
-d "pointsAmount=5"
STATUS: 200 OK
{
"customerId": "6102cef9-d263-46de-974d-ad2e89f6e81d",
"pointsAmount": 5,
"pointValue": 10,
"rewardAmount": 100
}
Reedem cashback (customer)
To reedem cashback, you need to call the /api/admin/customer/cashback/redeem
endpoint with the POST
method.
Definition
POST /api/customer/campaign/cashback/redeem
curl https://localhost:8181/api/customer/campaign/cashback/redeem \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "cashbackId=972012b8-633d-41e8-be5a-5125c1a5be63" \
-d "pointsAmount=5"
STATUS: 200 OK
{
"customerId": "6102cef9-d263-46de-974d-ad2e89f6e81d",
"pointsAmount": 5,
"pointValue": 10,
"rewardAmount": 50,
"cashbackId" : "972012b8-633d-41e8-be5a-5125c1a5be63"
}
Simulate cashback
To reedem cashback, you need to call the /api/admin/customer/cashback/simulate
endpoint with the POST
method.
Definition
POST /api/customer/campaign/cashback/simulate
curl https://localhost:8181/api/admin/campaign/cashback/simulate \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customerId=5bfded09-0931-4eac-baad-0d663cfd8976" \
-d "pointsAmount=10"
STATUS: 200 OK
{
"customerId": "5bfded09-0931-4eac-baad-0d663cfd8976",
"pointsAmount": 10,
"pointValue": "3.00",
"rewardAmount": 30
}
Create a new campaign
To create a new campaign, you need to call the /api/campaign
endpoint with the POST method.
Definition
POST /api/campaign
Parameter | Type | Required | Format | Description |
---|---|---|---|---|
campaign | object | true | ||
campaign[translations] | string | true | ||
campaign[coupons][] | array of strings | true | ||
campaign[reward] | choice | true | {"discount_code":"discount_code","event_code":"event_code","free_delivery_code":"free_delivery_code","gift_code":"gift_code","value_code":"value_code","cashback":"cashback","percentage_discount_code":"percentage_discount_code","custom_campaign_code":"custom_campaign_code"} | |
campaign[moreInformationLink] | string | false | ||
campaign[moreInformationLink] | string | false | ||
campaign[pushNotificationText] | string | false | ||
campaign[categories][] | array of strings | true | ||
campaign[rewardValue] | float | false | ||
campaign[tax] | float | false | ||
campaign[taxPriceValue] | float | false | ||
campaign[active] | boolean | false | ||
campaign[target] | choice | false | {"level":"level","segment":"segment"} | |
campaign[levels][] | array of strings | true | ||
campaign[segments][] | array of strings | true | ||
campaign[campaignActivity] | object (CampaignActivityFormType) | true | ||
campaign[campaignActivity][allTimeActive] | boolean | false | ||
campaign[campaignActivity][activeFrom] | datetime | false | yyyy-MM-dd'T'HH:mm:ss | |
campaign[campaignActivity][activeTo] | datetime | false | yyyy-MM-dd'T'HH:mm:ss | |
campaign[labels] | string | false | ||
campaign[featured] | boolean | false | ||
campaign[public] | boolean | false |
curl https://{yourinstance}/api/campaign \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "campaign[active]=1" \
-d "campaign[target]=level" \
-d "campaign[levels][0]=e82c96cf-32a3-43bd-9034-4df343e5fd94" \
-d "campaign[levels][1]=000096cf-32a3-43bd-9034-4df343e5fd94" \
-d "campaign[campaignActivity][activeFrom]=2017-09-05+10:59" \
-d "campaign[campaignActivity][activeTo]=2017-12-05+10:59"
STATUS: 200 OK
{
"campaignId": "3062c881-93f3-496b-9669-4238c0a62be8"
}
Get a collection of campaigns
To retrieve a paginated list of campaigns, you need to call the /api/campaign
endpoint with the GET
method.
Definition
GET /api/campaign
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
labels | request | (optional) Array of labels with key and/or value ie. labels[0][key]=key&labels[0][value]=value |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
format | query | (optional) Format of descriptions [html]. Default is RAW. |
categoryId[] | query | (optional) Array of category Ids |
To see the first page of all campaigns, use the curl method:
curl https://{yourinstance}/api/campaign?labels[0][key]=key&labels[0][value]=value \
-X "GET" -H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"campaigns": [
{
"levels": [
"000096cf-32a3-43bd-9034-4df343e5fd94"
],
"segments": [
"00000000-0000-0000-0000-000000000002"
],
"coupons": [
"123"
],
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"reward": "discount_code",
"name": "tests",
"active": true,
"costInPoints": 10,
"singleCoupon": false,
"unlimited": false,
"limit": 10,
"limitPerUser": 2,
"daysValid": 0,
"daysInactive": 0,
"campaignActivity": {
"allTimeActive": false,
"activeFrom": "2016-01-01T00:00:00+0100",
"activeTo": "2018-01-01T00:00:00+0100"
},
"campaignVisibility": {
"allTimeVisible": false,
"visibleFrom": "2016-01-01T00:00:00+0100",
"visibleTo": "2018-01-01T00:00:00+0100"
},
"segmentNames": {
"00000000-0000-0000-0000-000000000002": "anniversary"
},
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd94": "level2"
},
"labels": [
{
"key": "type",
"value": "promotion"
}
],
"usageLeft": 1,
"visibleForCustomersCount": 0,
"usersWhoUsedThisCampaignCount": 0,
"hasPhoto": false,
"translations": [
{
"name": "Promotion campaign",
"shortDescription": "_Campaign_ short description",
"conditionsDescription": "Some conditions description",
"usageInstruction": "Usage of coupon instruction",
"brandDescription": "Brand description",
"id": 32,
"locale": "en"
},
{
"name": "Promocyjna kampania",
"shortDescription": "Opis promocyjnej kampanii",
"id": 33,
"locale": "pl"
}
]
"total": 1
}
Get a collection of active campaigns
To retrieve a paginated list of active campaigns, you need to call the /api/campaign/active
endpoint with the GET
method.
Definition
GET /api/campaign/active
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
format | query | If set to html, the descriptions will be in HTML format |
To see the first page of all campaigns, use the curl method:
curl https://{yourinstance}/api/campaign/active \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NisInR5c..."
STATUS: 200 OK
{
"campaigns": [
{
"id": "000096cf-6361-4d70-e169-676e00000001",
"name": "Test configured campaign"
},
{
"id": "000096cf-6361-4d70-e169-676e00000003",
"name": "Reward campaign"
},
{
"id": "000096cf-6361-4d70-e169-676e11111111",
"name": "cashback"
},
{
"id": "000096cf-6361-4d70-e169-676e22222222",
"name": "Percentage discount code"
},
{
"id": "000096cf-6361-4d70-e169-676e55555555",
"name": "Discount code"
},]
}
Get a collection of bought campaigns
To retrieve a paginated list of bought campaigns, you need to call the /api/campaign/bought
endpoint with the GET
method.
Definition
GET /api/campaign/bought
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
used | request | (optional) Possible values : true/false |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
purchasedAtFrom | query | (optional) Purchase date from filter |
purchasedAtTo | query | (optional) Purchase date to filter |
usageDateFrom | query | (optional) Usage date from filter |
usageDateTo | query | (optional) Usage date to filter |
activeSinceFrom | query | (optional) Active since date from filter |
activeToFrom | query | (optional) Active since date to filter |
activeToTo | query | (optional) Active to date to filter |
deliveryStatus | query | Possible values: ordered, canceled, shipped, delivered |
To see the first page of all bought campaigns, use the curl method
curl https://{yourinstance}/api/campaign/bought \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"boughtCampaigns": [
{
"canBeUsed": true,
"rewardCampaignId": "000096cf-6361-4d70-e169-676e22222222",
"campaignId": "000096cf-6361-4d70-e169-676e22222222",
"customerId": "7ae0712b-f029-4839-9c53-278c37c6fd35",
"purchasedAt": "2019-03-14T10:29:05+0100",
"coupon": {
"code": "10",
"id": "d481c4f2-fa88-476a-9e12-a39f728d94d8"
},
"campaignType": "percentage_discount_code",
"campaignName": "Percentage discount code",
"customerEmail": "maxnowacki690711@test.pl",
"customerName": "Max",
"customerLastname": "Nowacki",
"campaignShippingAddress": {},
"costInPoints": 0,
"currentPointsAmount": 100,
"used": false,
"status": "active",
"transactionId": {
"transactionId": "33fbedb5-ff71-4a18-9711-4352d3b9e317"
},
"returnedAmount": 0,
"deliveryStatus": {
"status": ""
}
],
"total":1
},
}
Get a collection of campaigns exported to a CSV file
To retrieve a paginated list of campaigns exported to a CSV file, you need to call the /api/campaign/bought/export/csv
endpoint with the GET
method.
Definition
GET /api/campaign/bought/export/csv
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
purchasedAtFrom | query | (optional) Purchase date from filter |
purchasedAtTo | query | (optional) Purchase date to filter |
To see the first page of all campaigns in CSV file format, use the curl code
curl https://{yourinstance}/api/campaign/bought/export/csv \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Get a collection of publicly available campaigns
To retrieve a paginated list of campaigns that are publicly available, you need to call the /api/campaign/public/available
endpoint with the GET
method.
Definition
GET /api/campaign/public/available
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
hasSegment | boolean | false | Whether campaign is offered exclusively to some segments | |
categoryId[] | string | false | Filter by categories | |
page | integer | false | Page number | |
perPage | integer | false | Number of elements per page | |
sort | string | false | Field to sort by | |
direction | asc | desc | false | |
format | html/raw | false | If set to html, the descriptions will be in HTML format. Omit for raw output. |
curl https://{yourinstance}/api/campaign/public/available \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Update a campaign
To fully update a campaign, you need to call the /api/campaign/
endpoint with the PUT
method.
Definition
PUT /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
campaign | object | true | ||
campaign[translations] | string | true | ||
campaign[coupons][] | array of strings | true | ||
campaign[reward] | choice | true | {"discount_code":"discount_code","event_code":"event_code","free_delivery_code":"free_delivery_code","gift_code":"gift_code","value_code":"value_code","cashback":"cashback","percentage_discount_code":"percentage_discount_code","custom_campaign_code":"custom_campaign_code"} | |
campaign[moreInformationLink] | string | false | ||
campaign[pushNotificationText] | string | false | ||
campaign[categories][] | array of strings | true | ||
campaign[rewardValue] | float | false | ||
campaign[tax] | float | false | ||
campaign[taxPriceValue] | float | false | ||
campaign[active] | boolean | false | ||
campaign[target] | choice | false | {"level":"level","segment":"segment"} | |
campaign[levels][] | array of strings | true | ||
campaign[segments][] | array of strings | true | ||
campaign[campaignActivity] | object (CampaignActivityFormType) | true | ||
campaign[campaignActivity][allTimeActive] | boolean | false | ||
campaign[campaignActivity][activeFrom] | datetime | false | yyyy-MM-dd'T'HH:mm:ss | |
campaign[campaignActivity][activeTo] | datetime | false | yyyy-MM-dd'T'HH:mm:ss | |
campaign[labels] | string | false | ||
campaign[featured] | boolean | false | ||
campaign[public] | boolean | false |
curl https://{yourinstance}/api/campaign/**id \
-X "PUT" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "campaign[reward]=discount_code" \
-d "campaign[translations][en][reward]=discount_code" \
-d "campaign[active]=1" \
-d "campaign[target]=level" \
-d "campaign[costInPoints]=100" \
-d "campaign[target]=level" \
-d "campaign[campaignActivity][allTimeActive]=0" \
-d "campaign[campaignActivity][activeFrom]=2017-09-05+10:59" \
-d "campaign[campaignActivity][activeTo]=2017-12-05+10:59"
STATUS: 200 OK
Returned when successful
STATUS: 400
Returned when there are errors in form
STATUS: 404
Returned when campaign not found
Remove campaign’s brand icon
To remove a campaign’s brand icon from the campaign, you need to call the /api/campaign/{campaign}/brand_icon
endpoint with the DELETE
method.
Definition
DELETE /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID |
To remove a brand icon from the campaign campaign = id, use the curl method
curl https://{yourinstance}/api/campaign/**id \
-X "DELETE" \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..
STATUS: 200 OK
Returned when successful
STATUS: 204
No Content
Get a campaign’s brand icon
To get a campaign’s brand icon, you need to call the /api/campaign/{campaign}/brand_icon
endpoint with the GET
method.
Definition
GET /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID |
To get a brand icon for the campaign campaign = id
, use the curl method:
curl https://{yourinstance}/api/campaign/**id**/brand_icon \
-X "GET" \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Add a brand icon to the campaign
To add a brand icon to the campaign, you need to call the /api/campaign/{campaign}/brand_icon
endpoint with the POST
method.
Definition
POST /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID | ||
brand_icon | object | true | ||
brand_icon[file] | file | true | Absolute path to the photo |
To add a brand icon for the campaign campaign = id
, use the curl method:
curl https://{yourinstance}/api/campaign/id/brand_icon \
-X "POST" \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "brand_icon[file]=C:\fakepath\Photo.png"
STATUS: 200 OK
Returned when successful
STATUS: 204
No Content
Get campaign details
To retrieve the details of a campaign, you need to call the /api/campaign/{campaign}
endpoint with the GET
method.
Definition
GET /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID | ||
format | html | raw/false | If set to html, the descriptions will be in HTML format. Omit for raw output. |
curl https://{yourinstance}/api/campaign/id \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
STATUS: 404
Returned when campaign not found
Get available campaign for a customer
To check which campaigns are available for a specific customer, you need to call the /api/admin/customer/
endpoint with the GET
method.
Definition
GET /api/admin/customer/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
customer | CustomerDetails | Customer ID | ||
isFeatured | boolean | false | Filter by featured tag | |
isPublic | boolean | false | Filter by public flag | |
hasSegment | boolean | false | Whether campaign is offered exclusively to some segments | |
page | integer | false | Page number | |
perPage | integer | false | Number of elements per page | |
sort | string | false | Field to sort by | |
direction | asc/desc | false | Sorting direction | |
categoryId[] | string | false | Filter by categories | |
format | html/raw | false | If set to html, the descriptions will be in HTML format. Omit for raw output. |
curl https://{yourinstance}/api/admin/customer/**id**/campaign/available \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Buy reward campaign for a specific customer
To buy a reward campaign for a specific customer, you need to call the /api/admin/customer/
endpoint with the POST method.
Definition
POST /api/admin/customer/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
customer | CustomerDetails | Customer ID | ||
campaign | DomainCampaign | Campaign ID |
curl https://{yourinstance}/api/admin/customer/{customer-id}/campaign/{campaign-id}/buy
-X "POST"
-H "Accept: application/json"
-H "Content-type: application/x-www-form-urlencoded"
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Check campaign visibility for customers
To check reward campaign visibility for customers, you need to call the /api/campaign/
endpoint with the GET
method.
Definition
GET /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID | ||
page | integer | false | Page number | |
perPage | integer | false | Number of elements per page | |
sort | string | false | Field to sort by | |
direction | asc/desc | false | Sorting direction | |
format | html/raw | false | If set to html, the descriptions will be in HTML format. Omit for raw output. |
curl https://{yourinstance}/api/campaign/{campaignid}/customers/visible \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Get a campaign’s photo
To get a campaign’s photo, you need to call the /api/campaign/
endpoint with the GET
method.
Definition
GET /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID | ||
photo | object | true | ||
photo[file] | file | true |
curl https://{yourinstance}/api/campaign/{campaignid}/photo/{photoid} \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
STATUS: 404 Not Found
The campaign may not have a photo at all and you will receive the following response.
Remove a campaign’s photo
To remove a campaign’s photo, you need to call the /api/campaign/
endpoint with the DELETE
method.
Definition
DELETE /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID | ||
photoId | query | true |
curl https://{yourinstance}/api/campaign/{campaignId}/photo/{photoId} \
-X "DELETE" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
STATUS: 204
No Content
Add a photo to a campaign
To add a photo to a campaign, you need to call the /api/campaign/
endpoint with the POST
method.
Definition
POST /api/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID | ||
photo | object | true | ||
photo[file] | file | true | Absolute path to the photo |
curl https://{yourinstance}/api/campaign/id/photo \
-X "POST" \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "photo[file]=C:\fakepath\Photo.png"
STATUS: 200 OK
Change a campaign’s state
To make a campaign active or inactive, you need to call the /api/campaign/
endpoint with the POST
method.
Definition
POST /api/campaign/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
campaign | DomainCampaign | Campaign ID |
active | query | Possible values: active, inactive |
curl https://{yourinstance}/api/campaign/id/active \
-X "POST" \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
STATUS: 404
Not Found
Get a campaign collection (seller)
To retrieve a paginated list of campaigns, you need to call the /api/seller/campaign
endpoint with the GET
method.
Definition
GET /api/seller/campaign
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
isPublic | boolean | false | Filter by public flag | |
page | integer | false | Page number | |
perPage | integer | false | Number of elements per page | |
sort | string | false | Field to sort by | |
direction | asc/desc | false | Sorting direction |
curl https://{yourinstance}/api/seller/campaign \
-X "GET" -H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
{
"campaigns": [
{
"levels": [
"000096cf-32a3-43bd-9034-4df343e5fd93",
],
"segments": [],
"coupons": [
"123"
],
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"reward": "discount_code",
"name": "tests",
"active": true,
"limit": 10,
"campaignActivity": {
"allTimeActive": false,
"activeFrom": "2016-01-01T00:00:00+0100",
"activeTo": "2018-01-01T00:00:00+0100"
},
"campaignVisibility": {
"allTimeVisible": false,
"visibleFrom": "2016-01-01T00:00:00+0100",
"visibleTo": "2018-01-01T00:00:00+0100"
},
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0",
},
"labels": [
{
"key": "type",
"value": "promotion"
}
],
"usageLeft": 0,
"visibleForCustomersCount": 2,
"usersWhoUsedThisCampaignCount": 1
},
]
}
Get campaign details (seller)
To retrieve the details of a campaign, you need to call the /api/seller/campaign/{campaign}
endpoint with the GET
method.
Definition
GET /api/seller/campaign/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
campaign | DomainCampaign | Campaign ID | ||
format | html/raw | false | If set to html, the descriptions will be in HTML format. Omit for raw output. |
curl https://{yourinstance}/api/seller/campaign/{campaign} \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
{
"levels": [
"000096cf-32a3-43bd-9034-4df343e5fd93",
],
"segments": [],
"coupons": [
"123"
],
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"reward": "discount_code",
"name": "tests",
"active": true,
"limit": 10,
"campaignActivity": {
"allTimeActive": false,
"activeFrom": "2016-01-01T00:00:00+0100",
"activeTo": "2018-01-01T00:00:00+0100"
},
"campaignVisibility": {
"allTimeVisible": false,
"visibleFrom": "2016-01-01T00:00:00+0100",
"visibleTo": "2018-01-01T00:00:00+0100"
},
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0",
},
"labels": [
{
"key": "type",
"value": "promotion"
}
],
"usageLeft": 0,
"visibleForCustomersCount": 2,
"usersWhoUsedThisCampaignCount": 1
}
## Get available campaigns for a customer(Seller)
To check which campaigns are available for a specific customer, you need to call the <code> /api/seller/customer/<customer>/campaign/available</code> endpoint with the <code>GET</code> method.
### Definition
<code>GET /api/seller/customer/<customer>/campaign/available</code>
Parameter|Type|Required?|Format|Description
---------|----|---------|------|-----------
Authorization|header| | |Token received during authentication
customer|CustomerDetails| | |Customer ID
isFeatured|boolean|false| |Filter by featured tag
isPublic|boolean|false| |Filter by public flag
hasSegment|boolean|false| |Whether campaign is offered exclusively to some segments
page|integer|false| |Page number
perPage|integer|false| |Number of elements per page
sort|string|false| |Field to sort by
direction|asc/desc|false| |Sorting direction
categoryId[]|string|false| |Filter by categories
format|html/raw|false| |If set to html, the descriptions will be in HTML format. Omit for raw output.
```shell
curl https://{yourinstance}/api/seller/customer/**id**/campaign/available \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Buy reward campaign for a specific customer (seller)
To buy a reward campaign for a specific customer, you need to call the /api/seller/customer/
endpoint with the POST method.
Definition
POST /api/seller/customer/
Parameter | Type | Required? | Format | Description |
---|---|---|---|---|
Authorization | header | Token received during authentication | ||
customer | CustomerDetails | Customer ID | ||
campaign | DomainCampaign | Campaign ID |
curl https://{yourinstance}/api/seller/customer/{customer-id}/campaign/{campaign-id}/buy
-X "POST"
-H "Accept: application/json"
-H "Content-type: application/x-www-form-urlencoded"
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Campaigns categories API
These endpoints allow you to easily manage campaign categories. Campaign categories make it possibile to group campaigns into categories. One campaign can be assigned to many categories.
Create a new campaign category
To create a new category, you need to call the /api/campaignCategory
endpoint with the POST
method.
Definition
POST /api/campaignCategory
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
campaign_category[translations][en][name] | request | Campaign category name in given locale. |
campaign_category[active] | request | Set 1 if active, otherwise 0 |
campaign_category[sortOrder] | request | Sort order key. |
curl https://{yourinstance}/api/campaignCategory \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "campaign_category[translations][en][name]=Category+A" \
-d "campaign_category[active]=1" \
-d "campaign_category[sortOrder]=0"
STATUS: 200 OK
Returned when successful
Get a collection of campaign categories
To retrieve a paginated list of campaigns categories, you need to call the /api/campaignCategory
endpoint with the GET
method.
Definition
GET /api/campaignCategory
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
name | request | (optional) Filter by name |
active | request | (optional) Filter by activity |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 10 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
format | query | (optional) Format of descriptions [html]. Default is RAW. |
locale | query | (optional) Retrieves data in given locale |
curl https://{yourinstance}/api/campaignCategory \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
{
"categories": [
{
"name": "Category A",
"campaignCategoryId": "000096cf-32a3-43bd-9034-4df343e5fd99",
"active": true,
"sortOrder": 0,
"translations": [
{
"name": "Category A",
"id": 1,
"locale": "en"
},
{
"name": "cat A",
"id": 3,
"locale": "pl"
}
]
},
{
"name": "Category B",
"campaignCategoryId": "000096cf-32a3-43bd-9034-4df343e5fd98",
"active": true,
"sortOrder": 0,
"translations": [
{
"name": "Category B",
"id": 2,
"locale": "en"
},
{
"name": "cat B",
"id": 4,
"locale": "pl"
}
]
}
],
"total": 2
}
Update a campaign
To fully update a campaign, you need to call the /api/campaignCategory/
endpoint with the PUT
method.
Definition
PUT /api/campaignCategory/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
campaignCategory | query | Id of the campaign category |
campaign_category[translations][en][name] | request | Campaign category name in given locale. |
campaign_category[active] | request | Set 1 if active, otherwise 0 |
campaign_category[sortOrder] | request | Sort order key. |
curl https://{yourinstance}/api/campaignCategory/id \
-X "PUT" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "campaign_category[translations][en][name]=Category+A" \
-d "campaign_category[active]=1" \
-d "campaign_category[sortOrder]=0"
STATUS: 200 OK
Returned when successful
Get campaign category details
To retrieve the details of a campaign category, you need to call the /api/campaignCategory/{campaignCategory}
endpoint with the GET
method.
Definition
GET /api/campaignCategory/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
campaignCategory | query | Id of the campaign category |
locale | query | (optional) Retrieves data in given locale |
curl https://{yourinstance}/api/campaignCategory/id \
-X "GET" -H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
{
"name": "Category A",
"campaignCategoryId": "0000",
"active": true,
"sortOrder": 0,
"translations": [
{
"name": "Category A",
"id": 1,
"locale": "en"
},
{
"name": "cat A",
"id": 3,
"locale": "pl"
}
]
}
Activate or deactivate campaign category
To activate or deactivate a campaign category, you need to call the /api/campaignCategory/{campaignCategory}/active
endpoint with the POST
method.
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
campaignCategory | query | Id of the campaign category |
active | boolean | True of False |
curl https://{yourinstance}/api/campaignCategory/id/active \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "active=1"
STATUS: 200 OK
Returned when successful
STATUS: 204
NO content
Customer API
These endpoints allow you to easily manage customers.
Activate a customer
To activate a customer, you need to call the /api/admin/customer/{customer}/activate
endpoint with the POST
method.
Definition
POST /api/admin/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | CustomerDetails | Customer’s UUID |
curl https://{yourinstance}/api/admin/customer/*id*/activate \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Deactivate a customer
To deactivate a customer, you need to call the /api/admin/customer/{customer}/deactivate
endpoint with the POST
method.
Definition
POST /api/admin/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | CustomerDetails | Customer’s UUID |
curl https://{yourinstance}/api/admin/customer/*id*/deactivate \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Get customer status
To get a customer status, you need to call the /api/admin/customer/{customer}/status
endpoint with the GET
method.
Definition
GET /api/admin/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | CustomerDetails | Customer’s UUID |
curl https://{yourinstance}/api/admin/customer/*id*/status \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
Example Response:
{
"firstName": "Jane",
"lastName": "Doe",
"customerId": "00000000-0000-474c-b092-b0dd880c07e2",
"points": 206,
"usedPoints": 100,
"expiredPoints": 0,
"lockedPoints": 0,
"level": "14.00%",
"levelName": "level0",
"levelConditionValue": 0,
"nextLevel": "15.00%",
"nextLevelName": "level1",
"nextLevelConditionValue": 0,
"transactionsAmountWithoutDeliveryCosts": 3,
"transactionsAmountToNextLevel": 17,
"averageTransactionsAmount": "3.00",
"transactionsCount": 1,
"transactionsAmount": 3,
"pointsToNextLevel": 0,
"levelWillExpireInDays": 0,
"pointsSinceLastLevelRecalculation": 0,
"pointsRequiredToRetainLevel": 0,
"currency": "eur",
"pointsExpiringNextMonth": 150
}
Get customers
To get a list of customers, you need to call the /api/customer/
endpoint with the GET
method.
Definition
GET /api/customer
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
firstName | request | (optional) Customer’s first name |
lastName | request | (optional) Customer’s last name |
phone | request | (optional) Customer’s phone |
request | Customer’s email address | |
loyaltyCardNumber | request | (optional) Customer’s loyalty card number |
transactionsAmount | request | (optional) Customer’s transactions amount |
averageTransactionAmount | request | (optional) Customer’s average transaction amount |
transactionsCount | request(optional) Customer’s transactions count | |
daysFromLastTransaction | request | (optional) Customers days from last transaction |
hoursFromLastUpdate | request | (optional) Customer’s hours from last update |
manuallyAssignedLevel | request | manuallyAssignedLevel |
strict | query | (optional) If true, search for exact value, otherwise like value For example 1, by default = 0 |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 10 |
sort | query | (optional) Sort by column name. Note: column names corresponding to parameters ending in From or To do not have this suffix, eg. transactionCount, averageTransactionAmount. |
direction | asc/desc | Sorting direction |
curl https://{yourinstance}/api/customer \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Returned when successful
{
"customers": [
{
"customerId": "41fd3247-2069-4677-8904-584f0ed9f6be",
"active": true,
"firstName": "test",
"lastName": "test",
"email": "test4@example.com",
"address": {},
"createdAt": "2018-02-02T11:39:17+0100",
"levelId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"agreement1": true,
"agreement2": false,
"agreement3": false,
"updatedAt": "2018-02-02T11:39:28+0100",
"campaignPurchases": [],
"transactionsCount": 0,
"transactionsAmount": 0,
"transactionsAmountWithoutDeliveryCosts": 0,
"amountExcludedForLevel": 0,
"averageTransactionAmount": 0,
"currency": "eur",
"levelPercent": "14.00%"
},
],
"total":1
}
Example:
curl https://{yourinstance}/api/customer \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
-d "email=example.com" \
-d "strict=0" \
-d "page=1" \
-d "perPage=2" \
-d "sort=customerId" \
-d "direction=asc"
STATUS: 200 OK
{
"customers": [
{
"customerId": "00000000-0000-474c-b092-b0dd880c07e2",
"active": true,
"firstName": "Jane",
"lastName": "Doe",
"gender": "male",
"email": "user-temp@example.com",
"phone": "111112222",
"birthDate": "1990-09-11T02:00:00+0200",
"address": {
"street": "Bagno",
"address1": "1",
"province": "Mazowieckie",
"city": "Warszawa",
"postal": "00-000",
"country": "PL"
},
"loyaltyCardNumber": "0000",
"createdAt": "2016-08-08T10:53:14+0200",
"levelId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"agreement1": false,
"agreement2": false,
"agreement3": false,
"updatedAt": "2018-02-02T11:23:18+0100",
"campaignPurchases": [],
"transactionsCount": 1,
"transactionsAmount": 3,
"transactionsAmountWithoutDeliveryCosts": 3,
"amountExcludedForLevel": 0,
"averageTransactionAmount": 3,
"lastTransactionDate": "2018-02-03T11:23:21+0100",
"currency": "eur",
"levelPercent": "14.00%"
},
{
"customerId": "00000000-0000-474c-b092-b0dd880c07e1",
"active": false,
"firstName": "John",
"lastName": "Doe",
"gender": "male",
"email": "user@example.com",
"phone": "11111",
"birthDate": "1990-09-11T02:00:00+0200",
"createdAt": "2016-08-08T10:53:14+0200",
"levelId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"agreement1": false,
"agreement2": false,
"agreement3": false,
"updatedAt": "2018-02-02T11:23:17+0100",
"campaignPurchases": [],
"transactionsCount": 1,
"transactionsAmount": 3,
"transactionsAmountWithoutDeliveryCosts": 3,
"amountExcludedForLevel": 0,
"averageTransactionAmount": 3,
"lastTransactionDate": "2018-02-03T11:23:21+0100",
"currency": "eur",
"levelPercent": "14.00%"
}
],
"total": 2
}
Get a customer list as an admin
To get a list of all customers, you need to call the /api/admin/customer
endpoint with the GET
method.
Definition
GET /api/admin/customer
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
firstName | request | (optional) Customer’s first name |
lastName | request | (optional) Customer’s last name |
phone | request | (optional) Customer’s phone |
request | Customer’s email address | |
loyaltyCardNumber | request | (optional) Customer’s loyalty card number |
transactionsAmount | request | (optional) Customer’s transactions amount |
averageTransactionAmount | request | (optional) Customer’s average transaction amount |
transactionsCount | request(optional) Customer’s transactions count | |
daysFromLastTransaction | request | (optional) Customers days from last transaction |
hoursFromLastUpdate | request | (optional) Customer’s hours from last update |
manuallyAssignedLevel | request | manuallyAssignedLevel |
strict | query | (optional) If true, search for exact value, otherwise like value For example 1, by default = 0 |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 10 |
sort | query | (optional) Sort by column name. Note: column names corresponding to parameters ending in From or To do not have this suffix, eg. transactionCount, averageTransactionAmount. |
direction | asc/desc | Sorting direction |
curl https://{yourinstance}/api/admin/customer \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "email=example.com" \
-d "strict=0" \
-d "page=1" \
-d "perPage=2" \
-d "sort=customerId" \
-d "direction=asc"
STATUS: 200 OK
{
"customers": [
{
"customerId": "41fd3247-2069-4677-8904-584f0ed9f6be",
"active": true,
"firstName": "test",
"lastName": "test",
"email": "test4@example.com",
"address": {},
"createdAt": "2018-02-02T11:39:17+0100",
"levelId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"agreement1": true,
"agreement2": false,
"agreement3": false,
"updatedAt": "2018-02-02T11:39:28+0100",
"campaignPurchases": [],
"transactionsCount": 0,
"transactionsAmount": 0,
"transactionsAmountWithoutDeliveryCosts": 0,
"amountExcludedForLevel": 0,
"averageTransactionAmount": 0,
"currency": "eur",
"levelPercent": "14.00%"
},
{
"customerId": "142cbe32-da28-42d0-87aa-f93f3e1ebb91",
"active": true,
"firstName": "test",
"lastName": "test",
"email": "test3@example.com",
"address": {},
"createdAt": "2018-02-02T11:38:19+0100",
"levelId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"agreement1": true,
"agreement2": false,
"agreement3": false,
"updatedAt": "2018-02-02T11:38:20+0100",
"campaignPurchases": [],
"transactionsCount": 0,
"transactionsAmount": 0,
"transactionsAmountWithoutDeliveryCosts": 0,
"amountExcludedForLevel": 0,
"averageTransactionAmount": 0,
"currency": "eur",
"levelPercent": "14.00%"
}
],
"total": 2
}
Activate a customer using SMS activation token
To activate a customer using a token (sms code), you need to call the /api/customer/activate-sms/{token}
endpoint with the POST
method.
Definition
POST /api/customer/activate-sms/
Parameter | Type | Description |
---|---|---|
token | request | Customer’s token, SMS activation code |
curl https://{yourinstance}/api/customer/activate-sms/*****\
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded"
STATUS: 200 OK
Activate a customer using activation token
To activate a customer using a token, you need to call the /api/customer/activate/{token}
endpoint with the POST
method.
Definition
POST /api/customer/activate/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
token | request | Customer’s token |
curl https://{yourinstance}/api/customer/activate/abc \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Check if customer with given phone number or email exists
To check if a customer with a given phone number or email exists, you need to call the /api/customer/check
endpoint with the GET
method.
Definition
GET /api/customer/check
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
emailOrPhone | request | Customer’s email or phone |
curl https://{yourinstance}/api/customer/check?emailOrPhone=******** \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Create a new customer
To create a new customer, you need to call the /api/customer/register
endpoint with the POST
method.
Definition
POST /api/customer/register
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer[firstName] | request | First name |
customer[lastName] | request | Last name |
customer[gender] | request | (optional) Gender. Possible values male, female, not_disclosed |
customer[email] | request | (unique) E-mail address |
customer[phone] | request | (optional) A phone number (unique) |
customer[birthDate] | request | (optional) Birth date in format YYYY-MM-DD HH:mm, for example 2011-12-25 |
customer[createdAt] | request | (optional) Created at in format YYYY-MM-DD HH:mm:ss, for example 2015-09-26 14:15:16. |
customer[address] | request | Address |
customer[company] | request | Company |
customer[loyaltyCardNumber] | string | Loyalty card number |
customer[labels] | request | String of labels in form of key:val;key:val or an array of labels, each being an array having 'key' and 'value' key. |
customer[agreement1] | boolean | TOS Agreement (required to be true) |
customer[agreement2] | boolean | Direct Marketing Agreement (default false) |
customer[agreement3] | boolean | |
customer[referral_customer_email] | string |
curl https://{yourinstance}/api/customer/register \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customer[firstName]=John" \
-d "customer[lastName]=cena" \
-d "customer[email]=johncena@example.com" \
-d "customer[phone]=000000005000" \
-d "customer[agreement1]=1"
STATUS: 200 OK
Example
curl http://localhost:8181/api/customer/register \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customer[firstName]=John" \
-d "customer[lastName]=cena" \
-d "customer[email]=johncena@example.com" \
-d "customer[phone]=000000004000" \
-d "customer[birthDate]=1990-01-01" \
-d "customer[address]=Address" \
-d "customer[company]=company" \
-d "customer[loyaltyCardNumber]=00000000000000002" \
-d "customer[agreement1]=1" \
-d "customer[agreement2]=1" \
-d "customer[agreement3]=1"
STATUS: 200 OK
{
"customerId": "e0eb0355-8aaa-4fb1-8159-f58e81b7a25c",
"email": "johncena@example.com"
}
Get customer details
To get details about a customer, you need to call the /api/customer/
endpoint with the GET
method.
Definition
GET /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | CustomerDetails |
curl https://{yourinstance}/api/customer/**id** \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"customerId":"id",
"active": true,
"firstName": "John",
"lastName": "Doe",
"gender": "male",
"email": "user@example.com",
"phone": "+48234234000",
"birthDate": "1990-09-11T02:00:00+0200",
"lastLevelRecalculation": "2019-03-19T12:00:09+0100",
"loyaltyCardNumber": "47834433524",
"createdAt": "2016-08-08T10:53:14+0200",
"id": "id",
"levelId": 00000",
"agreement1": false,
"agreement2": false,
"agreement3": false,
"status": {
"availableTypes": [
"new",
"active",
"blocked",
"deleted"
],
"availableStates": [
"no-card",
"card-sent",
"with-card"
],
"type": "active",
"state": "no-card"
},
"updatedAt": "2019-03-19T11:52:49+0100",
"campaignPurchases": [],
"transactionsCount": 2,
"transactionsAmount": 3,
"transactionsAmountWithoutDeliveryCosts": 3,
"amountExcludedForLevel": 0,
"averageTransactionAmount": 1.5,
"lastTransactionDate": "2019-03-20T11:52:56+0100",
"labels": [],
"level": {
"levelId": {
"id": "0000",
"levelId": "00000"
},
"name": "level0",
"translations": {
"en": {
"name": "level0"
},
"pl": {
"name": "poziom0"
}
}
},
"version": 7,
"currency": "eur",
"segments": [],
"levelPercent": "0.00%"
}
Update a customer
To update an existing customer, you need to call the /api/customer/{customer}
endpoint with the PUT method.
Definition
PUT /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer[firstName] | request | First name |
customer[lastName] | request | Last name |
customer[gender] | request | (optional) Gender. Possible values male, female, not_disclosed |
customer[email] | request | (unique) E-mail address |
customer[phone] | request | (optional) A phone number (unique) |
customer[birthDate] | request | (optional) Birth date in format YYYY-MM-DD HH:mm, for example 2011-12-25 |
customer[createdAt] | request | (optional) Created at in format YYYY-MM-DD HH:mm:ss, for example 2015-09-26 14:15:16. |
customer[address] | request | Address |
customer[company] | request | Company |
customer[loyaltyCardNumber] | string | Loyalty card number |
customer[labels] | request | String of labels in form of key:val;key:val or an array of labels, each being an array having 'key' and 'value' key. |
customer[agreement1] | boolean | TOS Agreement (required to be true) |
customer[agreement2] | boolean | Direct Marketing Agreement (default false) |
customer[agreement3] | boolean | |
customer[referral_customer_email] | string |
curl https://{yourinstance}/api/customer/**id** \
-X "PUT" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customer[email]=john4@example.com" \
-d "customer[phone]=" \
-d "customer[agreement2]=1"
STATUS: 200 OK
{
"customerId": "**id**"
}
Example:
curl https://{yourinstance}/api/customer/**id** \
-X "PUT" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customer[email]=aaaa12"
STATUS: 400 Bad Request
{
"form": {
"children": {
"firstName": {},
"lastName": {},
"gender": {},
"email": {"errors": [
"This value is not a valid phone number."
]},
"phone": {
},
"birthDate": {},
"createdAt": {},
"address": {
"children": {
"street": {},
"address1": {},
"address2": {},
"postal": {},
"city": {},
"province": {},
"country": {}
}
},
"company": {
"children": {
"name": {},
"nip": {}
}
},
"loyaltyCardNumber": {},
"labels": {},
"agreement1": {},
"agreement2": {},
"agreement3": {},
"referral_customer_email": {},
"levelId": {},
"posId": {},
"sellerId": {}
}
},
"errors": []
}
Customer registrations
To get information about customer registrations, you need to call the /api/customer/registrations
endpoint with the GET
method.
Definition
GET /api/customer/registrations
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
interval | request | Group result by (day |
lastDays | request | Display data in last days |
curl https://{yourinstance}/api/customer/registrations \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"2018-03-06": 0,
"2018-03-07": 0,
"2018-03-08": 0,
"2018-03-09": 0,
"2018-03-10": 0,
"2018-03-11": 10,
"2018-03-12": 0,
"2018-03-13": 0,
"2018-03-14": 100,
"2018-03-15": 0,
"2018-03-16": 0,
"2018-03-17": 0,
"2018-03-18": 4,
"2018-03-19": 0,
"2018-03-20": 0,
"2018-03-21": 0,
"2018-03-22": 0,
"2018-03-23": 0,
"2018-03-24": 0,
"2018-03-25": 0,
"2018-03-26": 0,
"2018-03-27": 0,
"2018-03-28": 5,
"2018-03-29": 0,
"2018-03-30": 3,
"2018-03-31": 0,
"2018-04-01": 0,
"2018-04-02": 5,
"2018-04-03": 0,
"2018-04-04": 0,
"2018-04-05":0
}
Remove customer’s avatar
To remove the avatar of a customer using an admin token, you need to call the /api/customer/{customer}/avatar
endpoint with the DELETE
method.
Definition
DELETE /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/customer/**id**/avatar \
-X "DELETE" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
STATUS: 204 No Content
Get a customer’s avatar
To get a customer’s avatar using an admin token, you need to call the /api/customer/{customer}/avatar
endpoint with the GET
method.
Definition
GET /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/customer/**id**/avatar \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
STATUS: 204 No Content
Set customer’s avatar
To set a customer’s avatar using an admin token, you need to call the /api/customer/{customer}/avatar
endpoint with the POST
method.
Definition
GET /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
avatar[file] | request | Avatar file |
curl https://{yourinstance}/api/customer/**id**/avatar \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
-d "avatar[file]=C:\\fakepath\\avatar.jpg"
STATUS: 200 OK
STATUS: 204 No Content
Assign a customer to a level
To assign a customer to a level using an admin token, you need to call the /api/customer/{customer}/level
endpoint with the POST
method.
Definition
POST /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
levelId | request | Level ID |
curl https://{yourinstance}/api/customer/**id**/level \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "levelId=e82c96cf-32a3-43bd-9034-4df343e52222"
STATUS: 200 OK
Assign a POS to a customer
To assign a POS to a customer using an admin token, you need to call the /api/customer/{customer}/pos
endpoint with the POST
method.
Definition
POST /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
posId | request | POS ID |
curl https://{yourinstance}/api/customer/**id**/pos \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "posId=00000000-0000-474c-1111-b0dd880c07e3"
STATUS: 200 OK
List Pushy tokens
To list pushy tokens using an admin token, you need to call the /api/customer/{customer}/pushy-token
endpoint with the GET
method.
Definition
GET /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/customer/**id**/pushy-token \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"tokens": [
"pushy_token"
]
}
Add a Pushy token
To add a Pushy token to a customer using an admin token, you need to call the /api/customer/{customer}/pushy-token
endpoint with the POST
method.
Definition
POST /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
customer[pushyToken] | request | Customer’s pushy Token |
curl https://{yourinstance}/api/customer/**id**/pushy-token \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customer[pushyToken]=pushy_token"
STATUS: 200 OK
STATUS: 204 No Content
Remove a Pushy token
To remove a pushy token, you need to call the /api/customer/{customer}/pushy-token/{tokenToRemove}
endpoint with the DELETE
method.
Definition
DELETE /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
tokenToRemove | query | Pushy token to remove |
curl https://{yourinstance}/api/customer/**id**/pushy-token/pushy_token \
-X "DELETE" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 204 NO CONTENT
STATUS: Returned when customer's token wasn't removed.
Remove a customer from a manually assigned level
To unassign a customer from a manually assigned level using a token, you need to call the /api/customer/{customer}/remove-manually-level
endpoint with the POST
method.
Definition
POST /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/customer/**id**/remove-manually-level \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 204 No Content
Customer status (customer)
To retrieve the status of a customer, you need to call the /api/customer/customer/{customer}/status
endpoint with the GET
method.
Definition
GET /api/customer/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/customer/customer/**id**/status \
-X "GET" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"firstName": "Jane",
"lastName": "Doe",
"customerId": "id",
"points": 206,
"usedPoints": 100,
"expiredPoints": 0,
"lockedPoints": 0,
"level": "14.00%",
"levelName": "level0",
"levelConditionValue": 0,
"nextLevel": "15.00%",
"nextLevelName": "level1",
"nextLevelConditionValue": 0,
"transactionsAmountWithoutDeliveryCosts": 3,
"transactionsAmountToNextLevel": 17,
"averageTransactionsAmount": "3.00",
"transactionsCount": 1,
"transactionsAmount": 3,
"pointsToNextLevel": 0,
"levelWillExpireInDays": 0,
"pointsSinceLastLevelRecalculation": 0,
"pointsRequiredToRetainLevel": 0,
"currency": "eur",
"pointsExpiringNextMonth": 150
}
Customer status (seller)
To retrieve the status of specific customer, you need to call the /api/seller/customer/{customer}/status
endpoint with the GET
method.
Definition
GET /api/seller/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/seller/customer/**id**/status \
-X "GET" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"firstName": "Jane",
"lastName": "Doe",
"customerId": "00000000-0000-474c-b092-b0dd880c07e2",
"points": 206,
"usedPoints": 100,
"expiredPoints": 0,
"lockedPoints": 0,
"level": "14.00%",
"levelName": "level0",
"levelConditionValue": 0,
"nextLevel": "15.00%",
"nextLevelName": "level1",
"nextLevelConditionValue": 0,
"transactionsAmountWithoutDeliveryCosts": 3,
"transactionsAmountToNextLevel": 17,
"averageTransactionsAmount": "3.00",
"transactionsCount": 1,
"transactionsAmount": 3,
"pointsToNextLevel": 0,
"levelWillExpireInDays": 0,
"pointsSinceLastLevelRecalculation": 0,
"pointsRequiredToRetainLevel": 0,
"currency": "eur",
"pointsExpiringNextMonth": 150
}
Send an activation code to a customer as an admin
To send an SMS activation code to specific customer, you need to call the /api/admin/customer/{customer}/send-sms-code
endpoint with the POST
method.
Definition
POST /api/admin/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/admin/customer/00000000-0000-474c-b092-b0dd880c07e1/send-sms-code \
-X "POST" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Send an activation token as a customer
To send/resend an sms activation code, you need to call the /api/customer/customer-phone/send-sms-code
endpoint with the POST
method.
Definition
POST /api/customer/customer-phone/send-sms-code
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
curl https://{yourinstance}/api/customer/customer-phone/send-sms-code \
-X "POST" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Send SMS activation code as a seller
To send an SMS activation code to a specific customer, you need to call the /api/seller/customer/{customer}/send-sms-code
endpoint with the POST
method.
Definition
POST /api/seller/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/seller/customer/00000000-0000-474c-b092-b0dd880c07e1/send-sms-code \
-X "POST" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Assign a POS to a customer as a seller
To assign a POS to specific customer, you need to call the /api/seller/customer/{customer}/pos
endpoint with the POST
method.
Definition
POST /api/seller/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
posId | query | POS UUID |
curl https://{yourinstance}/api/seller/customer/00000000-0000-474c-b092-b0dd880c07e1/pos \
-X "POST" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "posId=00000000-0000-474c-1111-b0dd880c07e3"
STATUS: 200 OK
Activate a customer as a seller
To activate a specific customer, you need to call the /api/seller/customer/{customer}/activate
endpoint with the POST
method.
Definition
POST /api/seller/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/seller/customer/00000000-0000-474c-b092-b0dd880c07e1/activate \
-X "POST" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Deactivate a customer as a seller
To deactivate a specific customer, you need to call the /api/seller/customer/{customer}/deactivate
endpoint with the POST
method.
Definition
POST /api/seller/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/seller/customer/00000000-0000-474c-b092-b0dd880c07e1/deactivate \
-X "POST" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Register new customer as a seller
To register a customer, you need to call the /api/seller/customer/register
endpoint with the POST
method.
POST /api/seller/customer/register
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer[firstName] | request | First name |
customer[lastName] | request | Last name |
customer[gender] | request | (optional) Gender. Possible values male, female, not_disclosed |
customer[email] | request | (unique) E-mail address |
customer[phone] | request | (optional) A phone number (unique) |
customer[birthDate] | request | (optional) Birth date in format YYYY-MM-DD HH:mm, for example 2011-12-25 |
customer[createdAt] | request | (optional) Created at in format YYYY-MM-DD HH:mm:ss, for example 2015-09-26 14:15:16. |
customer[address] | request | Address |
customer[company] | request | Company |
customer[loyaltyCardNumber] | string | Loyalty card number |
customer[labels] | request | String of labels in form of key:val;key:val or an array of labels, each being an array having 'key' and 'value' key. |
customer[agreement1] | boolean | TOS Agreement (required to be true) |
customer[agreement2] | boolean | Direct Marketing Agreement (default false) |
customer[agreement3] | boolean | |
customer[referral_customer_email] | string |
curl https://{yourinstance}/api/seller/customer/register \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customer[firstName]=Lady" \
-d "customer[lastName]=Mini" \
-d "customer[email]=test@example.com" \
-d "customer[gender]=female" \
-d "customer[agreement1]=1"
STATUS: 200 OK
{
"customerId": "53c16b8e-db1e-42f9-af71-3bb76f5c3aca",
"email": "test@example.com"
}
Search for customers as a seller
To search for a customer in POS, you need to call the /api/pos/search/customer
endpoint with the POST
method.
Definition
POST /api/pos/search/customer
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
search | object | |
search[loyaltyCardNumber] | string | Loyalty card number |
search[phone] | string | A phone number |
search[email] | string | Email address |
search[firstName] | string | First name |
search[lastName] | string | Last name |
search[city] | string | City name |
search[postcode] | string | Post code |
curl https://{yourinstance}/api/pos/search/customer \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "search[firstName]=John" \
-d "search[lastName]=cena"
STATUS: 200 OK
Returned when successful
STATTUS: 400
Returned when form contains errors or there are to many results and search query should be more specific
Import customers
To import customers, you need to call the /api/admin/customer/import
endpoint with the POST
method.
Definition
POST /api/admin/customer/import
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
file | object | |
file[file] | file |
curl https://{yourinstance}/api/admin/customer/import \
-X "POST" \
-H "Accept:\ application/json" \
-H "Content-type:\ application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer\ eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "file[file]=C:\\fakepath\\customers.xml"
STATUS: 200 OK
{
"items": [
{
"status": "success",
"processImportResult": {
"object": "4e2a75c2-f194-40e7-b54e-f208b2fd1732"
},
"identifier": "aXXX2222X1@tXXXXXXXst.pl"
},
{
"status": "success",
"processImportResult": {
"object": "db081ad2-d035-4edd-8bda-21da198592db"
},
"identifier": "222b1222@test.pl"
},
{
"status": "error",
"message": "Convert exception: birthDate has invalid date format (Y-m-d required)",
"identifier": "b22221a@st.pl"
},
{
"status": "success",
"processImportResult": {
"object": "c4c169b0-265b-4ead-94c0-1972f181e100"
},
"identifier": "aa2222c@dgf.pl"
},
],
"totalProcessed": 4,
"totalSuccess": 3,
"totalFailed": 1
}
Register a new customer as an admin
To create a new customer, you need to call the /api/admin/customer/register
endpoint with the POST
method.
Definition
POST /api/admin/customer/register
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer[firstName] | request | First name |
customer[lastName] | request | Last name |
customer[gender] | request | (optional) Gender. Possible values male, female, not_disclosed |
customer[email] | request | (unique) E-mail address |
customer[phone] | request | (optional) A phone number (unique) |
customer[birthDate] | request | (optional) Birth date in format YYYY-MM-DD HH:mm, for example 2011-12-25 |
customer[createdAt] | request | (optional) Created at in format YYYY-MM-DD HH:mm:ss, for example 2015-09-26 14:15:16. |
customer[address] | request | Address |
customer[company] | request | Company |
customer[loyaltyCardNumber] | string | Loyalty card number |
customer[labels] | request | String of labels in form of key:val;key:val or an array of labels, each being an array having 'key' and 'value' key. |
customer[agreement1] | boolean | TOS Agreement (required to be true) |
customer[agreement2] | boolean | Direct Marketing Agreement (default false) |
customer[agreement3] | boolean | |
customer[referral_customer_email] | string |
curl https://{yourinstance}/api/admin/customer/register \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "customer[firstName]=abc" \
-d "customer[lastName]=def" \
-d "customer[email]=test@example.com" \
-d "customer[phone]=0665998332" \
-d "customer[agreement1]=1"
STATUS: 200 OK
{
"customerId": "e0eb0355-8aaa-4fb1-8159-f58e81b7a25c",
"email": "test@example.com"
}
Remove customer
To remove the customer using admin token you need to call the /api/customer/{customer}
endpoint with the DELETE
method.
Definition
DELETE /api/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | query | Customer ID |
curl https://{yourinstance}/api/customer/1cb6d205-8b77-40e1-a801-052185ed52d9 \
-X "DELETE" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
Customer Campaign API
These endpoints will allow you to see and use Reward Campaigns for a customer.
Get all campaigns bought by a customer
To retrieve a list of rewards bought by a specific customer use the api/admin/customer/{customer}/campaign/bought
endpoint with the GET
method.
Definition
GET /api/admin/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
includeDetails | boolean | Include details about bought campaign For example 1 |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
curl https://{yourinstance}/api/admin/customer/00000000-0000-474c-b092-b0dd880c07e1/campaign/bought \
-X "GET" \
-H "Accept:application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"campaigns": [],
"total": 0
}
"campaigns": [
{
"purchaseAt": "2018-01-30T18:23:24+0100",
"costInPoints": 20,
"campaignId": {
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93"
},
"used": false,
"coupon": {
"code": "123"
}
}
],
"total": 1
}
{
"campaigns": [
{
"purchaseAt": "2018-01-30T18:23:24+0100",
"costInPoints": 20,
"campaignId": {
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93"
},
"campaign": {
"levels": [
"000096cf-32a3-43bd-9034-4df343e5fd93",
"e82c96cf-32a3-43bd-9034-4df343e5fd94",
"000096cf-32a3-43bd-9034-4df343e5fd94",
"0f0d346e-9fd0-492a-84aa-2a2b61419c97"
],
"segments": [],
"coupons": [
"123"
],
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"reward": "discount_code",
"name": "tests",
"active": true,
"costInPoints": 20,
"singleCoupon": false,
"unlimited": false,
"limit": 10,
"limitPerUser": 2,
"campaignActivity": {
"allTimeActive": true
},
"campaignVisibility": {
"allTimeVisible": true
},
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0",
"e82c96cf-32a3-43bd-9034-4df343e5fd94": "level1",
"000096cf-32a3-43bd-9034-4df343e5fd94": "level2",
"0f0d346e-9fd0-492a-84aa-2a2b61419c97": "level3"
},
"usageLeft": 0,
"visibleForCustomersCount": 6,
"usersWhoUsedThisCampaignCount": 1
},
"used": false,
"coupon": {
"code": "123"
}
}
],
"total": 1
}
Get all campaigns available for a logged-in customer
To get all campaigns available for a logged-in customer, use the /api/customer/campaign/available
endpoint with the GET
method.
Definition
GET /api/customer/campaign/available
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
isFeatured | boolean | Filter by featured tag |
isPublic | boolean | Filter by whether the campaign is public or hidden; omit for all campaigns. |
hasSegment | boolean | Whether campaign is offered exclusively to some segments |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
categoryId[] | string | Filter by categories |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
curl https://{yourinstance}/api/customer/campaign/available \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"campaigns": [
{
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd92",
"reward": "discount_code",
"name": "for test",
"active": true,
"costInPoints": 10,
"singleCoupon": false,
"unlimited": false,
"limit": 10,
"limitPerUser": 2,
"campaignActivity": {
"allTimeActive": true
},
"campaignVisibility": {
"allTimeVisible": true
},
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0",
"e82c96cf-32a3-43bd-9034-4df343e5fd94": "level1",
"000096cf-32a3-43bd-9034-4df343e5fd94": "level2",
"0f0d346e-9fd0-492a-84aa-2a2b61419c97": "level3"
},
"usageLeft": 1,
"usageLeftForCustomer": 1,
"canBeBoughtByCustomer": true,
"visibleForCustomersCount": 6,
"usersWhoUsedThisCampaignCount": 0
}
],
"total": 1
}
Get all campaigns bought by a logged-in customer
To get all campaigns bought by a logged-in customer, use the /api/customer/campaign/bought
endpoint with the POST
method.
Definition
GET /api/customer/campaign/bought
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
includeDetails | boolean | Include details about bought campaign For example 1 |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
curl https://{yourinstance}/api/customer/campaign/bought \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"campaigns": [
{
"purchaseAt": "2018-01-30T18:23:24+0100",
"costInPoints": 20,
"campaignId": {
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93"
},
"used": false,
"coupon": {
"code": "123"
}
}
],
"total": 1
}
curl https://{yourinstance}/api/customer/campaign/bought \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "includeDetails=1"
STATUS: 200 OK
{
"campaigns": [
{
"purchaseAt": "2018-01-30T18:23:24+0100",
"costInPoints": 20,
"campaignId": {
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93"
},
"campaign": {
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"reward": "discount_code",
"name": "tests",
"active": true,
"costInPoints": 20,
"singleCoupon": false,
"unlimited": false,
"limit": 10,
"limitPerUser": 2,
"campaignActivity": {
"allTimeActive": true
},
"campaignVisibility": {
"allTimeVisible": true
},
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0",
"e82c96cf-32a3-43bd-9034-4df343e5fd94": "level1",
"000096cf-32a3-43bd-9034-4df343e5fd94": "level2",
"0f0d346e-9fd0-492a-84aa-2a2b61419c97": "level3"
},
"usageLeft": 0,
"visibleForCustomersCount": 6,
"usersWhoUsedThisCampaignCount": 1
},
"used": false,
"coupon": {
"code": "123"
}
}
],
"total": 1
}
Mark multiple coupons as used/unused by a customer.
Mark customer coupons as used/unused using the /api/admin/campaign/coupons/mark_as_used
endpoint with the POST
method.
Definition
POST /api/admin/campaign/coupons/mark_as_used
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
coupons | array | List of coupons to mark as used |
coupons[][used] | boolean | If coupon is used or not |
coupons[][campaignId] | string | CampaignId value |
coupons[][code] | string | Coupon code |
coupons[][couponId] | string | Coupon ID |
coupons[][transactionId] | string | Id of transaction in which this coupon was used |
coupons[][customerId] | request | CustomerID |
curl https://{yourinstance}/api/admin/campaign/coupons/mark_as_used \
-X "POST" -H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "coupons[0][campaignId]=f1eddc46-e985-43e8-bc2a-8007dca3df95" \
-d "coupons[0][couponId]=83d6a65e-d237-4049-84aa-bb107cd6f9a4" \
-d "coupons[0][code]=test1" \
-d "coupons[0][used]=1" \
-d "coupons[0][customerId]=00000000-0000-474c-b092-b0dd880c07e1" \
-d "coupons[0][campaignId]=f1eddc46-e985-43e8-bc2a-8007dca3df95" \
-d "coupons[0][couponId]=6a2456ec-49b3-4970-9ac4-75ca01eab0ee" \
-d "coupons[0][code]=test2" \
-d "coupons[0][used]=1" \
-d "coupons[0][customerId]=00000000-0000-474c-b092-b0dd880c07e1"
STATUS: 200 OK
{
"coupons": [
{
"name": "test1",
"used": true,
"campaignId": "f1eddc46-e985-43e8-bc2a-8007dca3df95",
"customerId": "00000000-0000-474c-b092-b0dd880c07e1"
},
{
"name": "test2",
"used": true,
"campaignId": "f1eddc46-e985-43e8-bc2a-8007dca3df95",
"customerId": "00000000-0000-474c-b092-b0dd880c07e1"
}
]
}
Mark a logged-in customer’s coupons as used
Mark coupons bought by a logged-in customer as used using the /api/customer/campaign/coupons/mark_as_used
endpoint with the POST
method.
Definition
POST /api/customer/campaign/coupons/mark_as_used
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
coupons | array | List of coupons to mark as used |
coupons[][used] | boolean | If coupon is used or not |
coupons[][campaignId] | string | CampaignId value |
coupons[][code] | string | Coupon code |
coupons[][couponId] | string | Coupon ID |
coupons[][transactionId] | string | Id of transaction in which this coupon was used |
curl https://{yourinstance}/api/customer/campaign/coupons/mark_as_used \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "coupons[0][campaignId]=00000000-0000-0000-0000-000000000001" \
-d "coupons[0][couponId]=00000000-0000-0000-0000-000000000002" \
-d "coupons[0][code]=WINTER" \
-d "coupons[0][used]=1" \
-d "coupons[0][transactionId]=00000000-0000-0000-0000-000000000003"
STATUS: 200 OK
{
"coupons": [
{
"name": "123",
"used": true,
"campaignId": "00000000-0000-0000-0000-000000000001",
"customerId": "00000000-0000-0000-0000-000000000004"
}
]
}
Example Error Response:
If there are no more coupons left, you will receive the following responses.
STATUS: 400 Bad Request
{
"error": {
"code": 400,
"message": "Bad Request"
}
}
Buy a campaign by the logged-in customer
To buy a campaign bought by the logged-in customer, use /api/customer/campaign/{campaign}/buy
endpoint with the POST
method.
Definition
POST /api/customer/campaign/{campaign}/buy
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
campaign | request | Campaign ID |
curl https://{yourinstance}/api/customer/campaign/000096cf-32a3-43bd-9034-4df343e5fd92/buy
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"coupons": [{
"code": "123",
"id": "ceb169c7-4fe2-4b49-9f2a-5a18634d7236"
}]
}
Example Error Response:
STATUS: 400 Bad Request
{
"error": "No coupons left"
}
Get all campaigns bought by a customer (seller)
To retrieve a list of rewards bought by a specific customer, use the api/seller/customer/{customer}/campaign/bought
endpoint with the GET
method.
Definition
GET /api/seller/customer/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
customer | request | Customer ID |
includeDetails | boolean | Include details about bought campaign For example 1 |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
curl https://{yourinstance}/api/seller/customer/00000000-0000-474c-b092-b0dd880c07e1/campaign/bought \
-X "GET" \
-H "Accept:application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"campaigns": [],
"total": 0
}
STATUS: 200 OK
{
"campaigns": [
{
"purchaseAt": "2018-01-30T18:23:24+0100",
"costInPoints": 20,
"campaignId": {
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93"
},
"used": false,
"coupon": {
"code": "123"
}
}
],
"total": 1
}
curl https://{yourinstance}/api/seller/customer/00000000-0000-474c-b092-b0dd880c07e1/campaign/bought \
-X "GET" -H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "includeDetails=1" \
-d "page=1" \
-d "perPage=1" \
-d "sort=used" \
-d "direction=DESC"
STATUS: 200 OK
{
"campaigns": [
{
"purchaseAt": "2018-01-30T18:23:24+0100",
"costInPoints": 20,
"campaignId": {
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93"
},
"campaign": {
"levels": [
"000096cf-32a3-43bd-9034-4df343e5fd93",
"e82c96cf-32a3-43bd-9034-4df343e5fd94",
"000096cf-32a3-43bd-9034-4df343e5fd94",
"0f0d346e-9fd0-492a-84aa-2a2b61419c97"
],
"segments": [],
"coupons": [
"123"
],
"campaignId": "000096cf-32a3-43bd-9034-4df343e5fd93",
"reward": "discount_code",
"name": "tests",
"active": true,
"costInPoints": 20,
"singleCoupon": false,
"unlimited": false,
"limit": 10,
"limitPerUser": 2,
"campaignActivity": {
"allTimeActive": true
},
"campaignVisibility": {
"allTimeVisible": true
},
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0",
"e82c96cf-32a3-43bd-9034-4df343e5fd94": "level1",
"000096cf-32a3-43bd-9034-4df343e5fd94": "level2",
"0f0d346e-9fd0-492a-84aa-2a2b61419c97": "level3"
},
"usageLeft": 0,
"visibleForCustomersCount": 6,
"usersWhoUsedThisCampaignCount": 1
},
"used": false,
"coupon": {
"code": "123"
}
}
],
"total": 1
}
Customer Earning API
These endpoints will allow you to easily viewing active earning rules.
Return all active earning rules
To view active earning rules, you need to call the /api/customer/earningRule
endpoint with the GET
method.
Definition
GET /api/customer/earningRule
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
curl https://{yourinstance}/api/customer/earningRule \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9..."
STATUS: 200 OK
{
"earningRules": [
{
{
"levels": [
"000096cf-32a3-43bd-9034-4df343e5fd93"
],
"segments": [],
"earningRuleId": "7664138c-b5a4-4dcd-80ba-0049a92166db",
"name": "name",
"description": "description",
"active": true,
"allTimeActive": true,
"usages": [],
"eventName": "custom_event_name",
"pointsAmount": 1,
"limit": {
"active": false
},
"type": "custom_event",
"usageUrl": "https://{yourinstance}/api/v1/earnRule/custom_event_name/customer/:customerId",
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0"
}
},
{
"levels": [
"000096cf-32a3-43bd-9034-4df343e5fd93"
],
"segments": [],
"earningRuleId": "7d482776-318a-48dd-90cd-6b3f06a3f4e8",
"name": "sdgsdgsdg",
"description": "description",
"active": true,
"allTimeActive": true,
"usages": [],
"eventName": "custom_event_name_1",
"pointsAmount": 1,
"limit": {
"active": false
},
"type": "custom_event",
"usageUrl": "https://yourinstance/api/v1/earnRule/custom_event_name_1/customer/:customerId",
"segmentNames": [],
"levelNames": {
"000096cf-32a3-43bd-9034-4df343e5fd93": "level0"
}
}
],
"currency": "eur"
}
Use a custom event earning rule
To trigger custom event earning rules, you need to call the /api/customer/earningRule/eventName
endpoint with the POST
method.
Definition
POST /api/customer/earningRule/
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
eventName | string | Name of custom event |
curl https://{yourinstance}/api/customer/earningRule/customerAttendedEvent \
-X "POST" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9..."
STATUS: 200 OK
{
"points": 14
}
Customer Level API
These endpoints will allow you to see Levels for a customer.
Get a complete list of levels
To retrieve a complete list of levels, you need to call the /api/customer/level
endpoint with the GET
method.
Definition
GET /api/customer/level
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
curl https://{yourinstance}/api/customer/level \
-X "GET" \
-H "Accept: application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"levels": [
{
"name": "level1",
"description": "example level",
"conditionValue": 20,
"hasPhoto": true
},
{
"name": "level2",
"description": "example level",
"conditionValue": 200,
"hasPhoto": false
},
],
"total": 2
}
Customer Points transfers
These endpoints will allow you to see Customer Points transfers list.
List of all logged-in customer points transfer
To retrieve a list of points transfer by a specific customer, use /api/customer/points/transfer
endpoint with the GET
method.
Definition
GET /api/customer/points/transfer
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
state | query | Set 1 if always active, otherwise 0 |
type | query | Current points status: adding or spending |
page | query | (optional) Start from page, by default 1 |
perPage | query | (optional) Number of items to display per page, by default = 30 |
sort | query | (optional) Sort by column name |
direction | query | (optional) Direction of sorting [ASC, DESC], by default = ASC |
curl https://{yourinstance}/api/customer/points/transfer \
-X "GET" \
-H "Accept:application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..."
STATUS: 200 OK
{
"transfers": [
{
"pointsTransferId": "e82c96cf-32a3-43bd-9034-4df343e5f211",
"accountId": "adbdb586-317b-4bed-8cc0-346199064d45",
"customerId": "00000000-0000-474c-b092-b0dd880c07e1",
"customerFirstName": "John",
"customerLastName": "cena",
"customerEmail": "user@example.com",
"customerPhone": "11111",
"createdAt": "2018-01-21T09:45:05+0100",
"value": 100,
"state": "active",
"type": "adding",
"issuer": "system",
"expireAt": "2018-02-20T09:45:05+0100"
},
],
"total": 1
}
Transfer points between customers
To transfer points owned by a specific customer to another customer, use the /api/customer/points/p2p-transfer
endpoint with the POST
method.
Definition
POST /api/customer/points/p2p-transfer
Parameter | Type | Description |
---|---|---|
Authorization | header | Token received during authentication |
transfer[receiver] | string | CustomerID |
transfer[points] | float | Number of point |
curl https://{yourinstance}/api/customer/points/p2p-transfer \
-X "POST" \
-H "Accept:application/json" \
-H "Content-type: application/x-www-form-urlencoded" \
-H "Authorization:\ Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6..." \
-d "transfer[receiver]=00000000-0000-474c-b092-b0dd880c07f5" \
-d "transfer[points]=11"
STATUS: 200 OK
{
"pointsTransferId": "5e-4590-ac2d-0b3e0b8f4c7e"
}