GET/ point-acquire-rule/
Get point acquisition rules
You can return all of your point acquisition rules.
Results are paginated: follow next to get the next page (see Response pagination).
Request
- cURL
- JavaScript
- PHP
- Python
curl -X GET "https://<your_app_subdomain>.user.com/api/public/point-acquire-rule/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/point-acquire-rule/",
{
method: "GET",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
},
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/point-acquire-rule/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.get(
"https://<your_app_subdomain>.user.com/api/public/point-acquire-rule/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
)
print(response.json())
Response examples
- 200 OK
{"count": 1,"next": null,"previous": null,"results": [{"id": 3,"name": "Points for a newsletter signup","points_expiration_relative_time": null,"points_expiration_time": null,"earning_type": 1,"earning_value": "50.00","count_points_from": null,"count_points_to": null,"max_points_daily": null,"max_points_per_transaction": null,"max_trigger_count_interval": null,"max_trigger_count_value": null,"end_date": null,"product_event": null,"products": null,"point_campaign": 12,"user_attribute": null,"event": null,"event_attribute": null,"product_attribute": null,"level_thresholds": []}]}Response fields
Fields returned in the 200 OK response body.
- count
- Number of results across all pages. It can lag behind recent changes; see Response pagination.
- next
- URL of the next page of results. null on the last page.
- previous
- URL of the previous page of results. null on the first page.
- results
- Results on this page.
- results[].
id - ID of the point acquisition rule.
- results[].
name - Name of the point acquisition rule.
- results[].
points_expiration_relative_time - Number of hours after which points earned through this rule expire;
nullif they don't. - results[].
points_expiration_time - When all points earned through this rule expire, ISO 8601;
nullif there's no such date. - results[].
earning_type - How points are counted:
0static (earning_valuepoints per use) or1dynamic (earning_valuetimes the price or order value). - results[].
earning_value - Points per use (static) or per unit of price (dynamic), as a decimal string.
- results[].
count_points_from - Lowest price or order value that earns points with dynamic earning;
nullfor no minimum. - results[].
count_points_to - Highest price or order value that earns points with dynamic earning;
nullfor no maximum. - results[].
max_points_daily - Most points a contact can earn from this rule per day;
nullfor no limit. - results[].
max_points_per_transaction - Most points a contact can earn from this rule in one transaction with dynamic earning;
nullfor no limit. - results[].
max_trigger_count_interval - Number of days that
max_trigger_count_valuecounts over;nullmeans over the rule's whole life. - results[].
max_trigger_count_value - Most times a contact can use this rule, within
max_trigger_count_intervaldays if set;nullfor no limit. - results[].
end_date - When the rule stops working, ISO 8601;
nullif it doesn't. - results[].
product_event - Product event type that earns points, for example
2(purchase);nullif the rule uses an event. - results[].
products - A list of products' ids.
- results[].
point_campaign - ID of the loyalty campaign the rule belongs to.
- results[].
user_attribute name_stdof the contact attribute that stores the earned points.- results[].
event - ID of the event that earns points;
nullif the rule uses a product event. - results[].
event_attribute - ID of the event attribute that holds the order value for dynamic earning;
nullif not used. - results[].
product_attribute - ID of the product attribute that holds the price for dynamic earning;
nullif not used. - results[].
level_thresholds - IDs of the customer levels a contact needs to earn points from this rule; empty for everyone.
- results[].
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.