JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.points.system("points-system-key");from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.points.system(key="points-system-key")import (
"context"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Points.System(context.TODO(), "points-system-key")curl --request GET \
--url https://api.trophy.so/v1/points/{key} \
--header 'X-API-KEY: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trophy.so/v1/points/{key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.trophy.so/v1/points/{key}")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trophy.so/v1/points/{key}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"name": "XP System",
"description": "Experience points for user engagement",
"badgeUrl": "https://example.com/badge.png",
"maxPoints": null,
"triggers": [
{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"type": "metric",
"points": 10,
"status": "active",
"metricId": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"metricName": "words written",
"metricThreshold": 1000,
"userAttributes": [
{
"key": "plan-type",
"value": "premium"
},
{
"key": "region",
"value": "us-east"
}
],
"eventAttribute": {
"key": "source",
"value": "mobile-app"
},
"eventAttributes": [
{
"key": "source",
"value": "mobile-app"
},
{
"key": "plan",
"value": "premium"
}
],
"created": "2021-01-01T00:00:00Z",
"updated": "2021-01-01T00:00:00Z"
},
{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123536",
"type": "streak",
"points": 10,
"status": "active",
"streakLengthThreshold": 7,
"created": "2021-01-01T00:00:00Z",
"updated": "2021-01-01T00:00:00Z"
},
{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123535",
"type": "achievement",
"points": 50,
"status": "active",
"achievementId": "0040fe51-6bce-4b44-b0ad-bddc4e123535",
"achievementName": "finish onboarding",
"userAttributes": [
{
"key": "plan-type",
"value": "premium"
}
],
"created": "2021-01-01T00:00:00Z",
"updated": "2021-01-01T00:00:00Z"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}Points
Get a points system with its triggers
Get a points system with its triggers.
GET
/
points
/
{key}
JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.points.system("points-system-key");from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.points.system(key="points-system-key")import (
"context"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Points.System(context.TODO(), "points-system-key")curl --request GET \
--url https://api.trophy.so/v1/points/{key} \
--header 'X-API-KEY: <api-key>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trophy.so/v1/points/{key}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.trophy.so/v1/points/{key}")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trophy.so/v1/points/{key}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"name": "XP System",
"description": "Experience points for user engagement",
"badgeUrl": "https://example.com/badge.png",
"maxPoints": null,
"triggers": [
{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"type": "metric",
"points": 10,
"status": "active",
"metricId": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
"metricName": "words written",
"metricThreshold": 1000,
"userAttributes": [
{
"key": "plan-type",
"value": "premium"
},
{
"key": "region",
"value": "us-east"
}
],
"eventAttribute": {
"key": "source",
"value": "mobile-app"
},
"eventAttributes": [
{
"key": "source",
"value": "mobile-app"
},
{
"key": "plan",
"value": "premium"
}
],
"created": "2021-01-01T00:00:00Z",
"updated": "2021-01-01T00:00:00Z"
},
{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123536",
"type": "streak",
"points": 10,
"status": "active",
"streakLengthThreshold": 7,
"created": "2021-01-01T00:00:00Z",
"updated": "2021-01-01T00:00:00Z"
},
{
"id": "0040fe51-6bce-4b44-b0ad-bddc4e123535",
"type": "achievement",
"points": 50,
"status": "active",
"achievementId": "0040fe51-6bce-4b44-b0ad-bddc4e123535",
"achievementName": "finish onboarding",
"userAttributes": [
{
"key": "plan-type",
"value": "premium"
}
],
"created": "2021-01-01T00:00:00Z",
"updated": "2021-01-01T00:00:00Z"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Headers
The tenant identifier for multi-tenant organisations. Required when the organisation has multi-tenancy enabled. The value should be your internal ID for the tenant. Ignored for single-tenant organisations.
Path Parameters
Key of the points system.
Response
Successful operation
The unique ID of the points system.
The name of the points system.
The description of the points system.
The URL of the badge image for the points system, if one has been uploaded.
The maximum number of points a user can be awarded in this points system
Array of active triggers for this points system.
Show child attributes
Show child attributes
Was this page helpful?
⌘I