JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.admin.streaks.freezes.create({
freezes: [
{ userId: 'user-123' },
{ userId: 'user-456' },
]
});from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.admin.streaks.freezes.create({
"freezes": [
{"userId": "user-123"},
{"userId": "user-456"}
]
})import (
"context"
api "github.com/trophyso/trophy-go"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Admin.Streaks.Freezes.Create(context.TODO(), nil)curl --request POST \
--url https://admin.trophy.so/v1/streaks/freezes \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"freezes": [
{
"userId": "user-123"
},
{
"userId": "user-456"
},
{
"userId": "user-123"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.trophy.so/v1/streaks/freezes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'freezes' => [
[
'userId' => 'user-123'
],
[
'userId' => 'user-456'
],
[
'userId' => 'user-123'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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.post("https://admin.trophy.so/v1/streaks/freezes")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"freezes\": [\n {\n \"userId\": \"user-123\"\n },\n {\n \"userId\": \"user-456\"\n },\n {\n \"userId\": \"user-123\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.trophy.so/v1/streaks/freezes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"freezes\": [\n {\n \"userId\": \"user-123\"\n },\n {\n \"userId\": \"user-456\"\n },\n {\n \"userId\": \"user-123\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"issues": [
{
"userId": "user-789",
"severity": "warning",
"message": "Would exceed maximum freeze limit"
}
]
}Admin
Create streak freezes for multiple users
Create streak freezes for multiple users.
POST
/
streaks
/
freezes
JavaScript
import { TrophyApiClient } from '@trophyso/node';
const trophy = new TrophyApiClient({
apiKey: 'YOUR_API_KEY'
});
const response = await trophy.admin.streaks.freezes.create({
freezes: [
{ userId: 'user-123' },
{ userId: 'user-456' },
]
});from trophy import TrophyApi
client = TrophyApi(api_key='YOUR_API_KEY')
response = client.admin.streaks.freezes.create({
"freezes": [
{"userId": "user-123"},
{"userId": "user-456"}
]
})import (
"context"
api "github.com/trophyso/trophy-go"
trophyclient "github.com/trophyso/trophy-go/client"
"github.com/trophyso/trophy-go/option"
)
client := trophyclient.NewClient(
option.WithApiKey("YOUR_API_KEY"),
)
response, err := client.Admin.Streaks.Freezes.Create(context.TODO(), nil)curl --request POST \
--url https://admin.trophy.so/v1/streaks/freezes \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"freezes": [
{
"userId": "user-123"
},
{
"userId": "user-456"
},
{
"userId": "user-123"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.trophy.so/v1/streaks/freezes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'freezes' => [
[
'userId' => 'user-123'
],
[
'userId' => 'user-456'
],
[
'userId' => 'user-123'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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.post("https://admin.trophy.so/v1/streaks/freezes")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"freezes\": [\n {\n \"userId\": \"user-123\"\n },\n {\n \"userId\": \"user-456\"\n },\n {\n \"userId\": \"user-123\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.trophy.so/v1/streaks/freezes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"freezes\": [\n {\n \"userId\": \"user-123\"\n },\n {\n \"userId\": \"user-456\"\n },\n {\n \"userId\": \"user-123\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"issues": [
{
"userId": "user-789",
"severity": "warning",
"message": "Would exceed maximum freeze limit"
}
]
}Authorizations
Headers
The tenant identifier for multi-tenant organisations. Required when the organisation has multi-tenancy enabled. Pass your own internal customer ID for the tenant. Ignored for single-tenant organisations.
Body
application/json
Array of freezes to create
Request body for creating streak freezes.
Array of freezes to create. Maximum 100 freezes per request.
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Response
Successful operation (no freezes created)
Response containing any issues encountered while creating streak freezes.
Array of issues encountered during freeze creation.
Show child attributes
Show child attributes
Was this page helpful?
⌘I