curl --request GET \
--url https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc",
{
method: "GET",
headers: { Authorization: "<api-key>" },
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc",
headers={"Authorization": "<api-key>"},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: <api-key>"],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": {
"type": "earning_history_entry",
"id": "entry_abc",
"attributes": {
"earning_rule_id": "rule_abc",
"action": "purchase",
"points": 150,
"base_points": 100,
"points_multiplier": 1.5,
"status": "approved",
"order_id": "5678901234",
"order_number": "#1042",
"points_due_at": null,
"points_given_at": "2024-06-01T12:05:00.000Z",
"points_expiry_at": null,
"created_at": "2024-06-01T12:00:00.000Z",
"updated_at": "2024-06-01T12:05:00.000Z"
}
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Earning history entry 'entry_abc' not found"
}
]
}
Customers
Get earning history entry
Get a single earning history entry.
GET
/
v1
/
customers
/
{identifier}
/
earning-history
/
{id}
curl --request GET \
--url https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc",
{
method: "GET",
headers: { Authorization: "<api-key>" },
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc",
headers={"Authorization": "<api-key>"},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: <api-key>"],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": {
"type": "earning_history_entry",
"id": "entry_abc",
"attributes": {
"earning_rule_id": "rule_abc",
"action": "purchase",
"points": 150,
"base_points": 100,
"points_multiplier": 1.5,
"status": "approved",
"order_id": "5678901234",
"order_number": "#1042",
"points_due_at": null,
"points_given_at": "2024-06-01T12:05:00.000Z",
"points_expiry_at": null,
"created_at": "2024-06-01T12:00:00.000Z",
"updated_at": "2024-06-01T12:05:00.000Z"
}
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Earning history entry 'entry_abc' not found"
}
]
}
Get a single earning history entry by its ID. Validates that the entry belongs to the given customer and shop.
Response
Returns a single earning history entry object.Errors
| Status | Scenario |
|---|---|
404 | Entry or customer not found |
429 | Rate limit exceeded (6 requests/second) |
curl --request GET \
--url https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc",
{
method: "GET",
headers: { Authorization: "<api-key>" },
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc",
headers={"Authorization": "<api-key>"},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/customers/6789012345/earning-history/entry_abc");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: <api-key>"],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": {
"type": "earning_history_entry",
"id": "entry_abc",
"attributes": {
"earning_rule_id": "rule_abc",
"action": "purchase",
"points": 150,
"base_points": 100,
"points_multiplier": 1.5,
"status": "approved",
"order_id": "5678901234",
"order_number": "#1042",
"points_due_at": null,
"points_given_at": "2024-06-01T12:05:00.000Z",
"points_expiry_at": null,
"created_at": "2024-06-01T12:00:00.000Z",
"updated_at": "2024-06-01T12:05:00.000Z"
}
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Earning history entry 'entry_abc' not found"
}
]
}
⌘I