Update an achievement by id
curl --request POST \
--url https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"criteria": {
"type": "sum",
"parameters": {
"query": "<string>",
"attribute": "<string>",
"value": 123
}
},
"queries": [
{
"type": "event",
"alias": "<string>",
"parameters": {
"eventName": "<string>",
"eventSourceId": "<string>",
"tags": [
"<string>"
]
},
"isCommunityScoped": true
}
],
"queryDescriptions": {},
"tags": [
"<string>"
],
"campaigns": [
"<string>"
],
"startsAt": "<string>",
"expiresAt": "<string>",
"featured": true,
"isGlobalTemplate": true,
"availableAsTemplateForOrganisations": [
"<string>"
],
"communityId": "<string>",
"details": {
"title": "<string>",
"description": "<string>",
"light": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
},
"dark": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
}
}
}
'import requests
url = "https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}"
payload = {
"criteria": {
"type": "sum",
"parameters": {
"query": "<string>",
"attribute": "<string>",
"value": 123
}
},
"queries": [
{
"type": "event",
"alias": "<string>",
"parameters": {
"eventName": "<string>",
"eventSourceId": "<string>",
"tags": ["<string>"]
},
"isCommunityScoped": True
}
],
"queryDescriptions": {},
"tags": ["<string>"],
"campaigns": ["<string>"],
"startsAt": "<string>",
"expiresAt": "<string>",
"featured": True,
"isGlobalTemplate": True,
"availableAsTemplateForOrganisations": ["<string>"],
"communityId": "<string>",
"details": {
"title": "<string>",
"description": "<string>",
"light": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
},
"dark": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
}
}
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
criteria: {
type: 'sum',
parameters: {query: '<string>', attribute: '<string>', value: 123}
},
queries: [
{
type: 'event',
alias: '<string>',
parameters: {eventName: '<string>', eventSourceId: '<string>', tags: ['<string>']},
isCommunityScoped: true
}
],
queryDescriptions: {},
tags: ['<string>'],
campaigns: ['<string>'],
startsAt: '<string>',
expiresAt: '<string>',
featured: true,
isGlobalTemplate: true,
availableAsTemplateForOrganisations: ['<string>'],
communityId: '<string>',
details: {
title: '<string>',
description: '<string>',
light: {primaryImageUrl: '<string>', secondaryImageUrl: '<string>'},
dark: {primaryImageUrl: '<string>', secondaryImageUrl: '<string>'}
}
})
};
fetch('https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}",
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([
'criteria' => [
'type' => 'sum',
'parameters' => [
'query' => '<string>',
'attribute' => '<string>',
'value' => 123
]
],
'queries' => [
[
'type' => 'event',
'alias' => '<string>',
'parameters' => [
'eventName' => '<string>',
'eventSourceId' => '<string>',
'tags' => [
'<string>'
]
],
'isCommunityScoped' => true
]
],
'queryDescriptions' => [
],
'tags' => [
'<string>'
],
'campaigns' => [
'<string>'
],
'startsAt' => '<string>',
'expiresAt' => '<string>',
'featured' => true,
'isGlobalTemplate' => true,
'availableAsTemplateForOrganisations' => [
'<string>'
],
'communityId' => '<string>',
'details' => [
'title' => '<string>',
'description' => '<string>',
'light' => [
'primaryImageUrl' => '<string>',
'secondaryImageUrl' => '<string>'
],
'dark' => [
'primaryImageUrl' => '<string>',
'secondaryImageUrl' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}"
payload := strings.NewReader("{\n \"criteria\": {\n \"type\": \"sum\",\n \"parameters\": {\n \"query\": \"<string>\",\n \"attribute\": \"<string>\",\n \"value\": 123\n }\n },\n \"queries\": [\n {\n \"type\": \"event\",\n \"alias\": \"<string>\",\n \"parameters\": {\n \"eventName\": \"<string>\",\n \"eventSourceId\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"isCommunityScoped\": true\n }\n ],\n \"queryDescriptions\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"campaigns\": [\n \"<string>\"\n ],\n \"startsAt\": \"<string>\",\n \"expiresAt\": \"<string>\",\n \"featured\": true,\n \"isGlobalTemplate\": true,\n \"availableAsTemplateForOrganisations\": [\n \"<string>\"\n ],\n \"communityId\": \"<string>\",\n \"details\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"light\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n },\n \"dark\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"criteria\": {\n \"type\": \"sum\",\n \"parameters\": {\n \"query\": \"<string>\",\n \"attribute\": \"<string>\",\n \"value\": 123\n }\n },\n \"queries\": [\n {\n \"type\": \"event\",\n \"alias\": \"<string>\",\n \"parameters\": {\n \"eventName\": \"<string>\",\n \"eventSourceId\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"isCommunityScoped\": true\n }\n ],\n \"queryDescriptions\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"campaigns\": [\n \"<string>\"\n ],\n \"startsAt\": \"<string>\",\n \"expiresAt\": \"<string>\",\n \"featured\": true,\n \"isGlobalTemplate\": true,\n \"availableAsTemplateForOrganisations\": [\n \"<string>\"\n ],\n \"communityId\": \"<string>\",\n \"details\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"light\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n },\n \"dark\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"criteria\": {\n \"type\": \"sum\",\n \"parameters\": {\n \"query\": \"<string>\",\n \"attribute\": \"<string>\",\n \"value\": 123\n }\n },\n \"queries\": [\n {\n \"type\": \"event\",\n \"alias\": \"<string>\",\n \"parameters\": {\n \"eventName\": \"<string>\",\n \"eventSourceId\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"isCommunityScoped\": true\n }\n ],\n \"queryDescriptions\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"campaigns\": [\n \"<string>\"\n ],\n \"startsAt\": \"<string>\",\n \"expiresAt\": \"<string>\",\n \"featured\": true,\n \"isGlobalTemplate\": true,\n \"availableAsTemplateForOrganisations\": [\n \"<string>\"\n ],\n \"communityId\": \"<string>\",\n \"details\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"light\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n },\n \"dark\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"organisationId": "<string>",
"details": {
"title": "<string>",
"description": "<string>",
"light": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
},
"dark": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
}
},
"progressPeriod": "daily",
"displayMode": "default",
"tags": [
"<string>"
],
"campaigns": [
"<string>"
],
"criteria": {
"type": "sum",
"parameters": {
"query": "<string>",
"operator": "==",
"attribute": "<string>",
"value": 123
}
},
"queries": [
{
"type": "event",
"alias": "<string>",
"parameters": {
"eventName": "<string>",
"eventCategory": "achievement",
"eventSubCategory": "achievement-completion",
"eventSourceId": "<string>",
"tags": [
"<string>"
]
},
"isCommunityScoped": true
}
],
"queryDescriptions": {},
"status": "archived",
"availableAsTemplateForOrganisations": [
"<string>"
],
"isGlobalTemplate": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"rewardDistribution": {
"points": 1,
"xp": 1,
"rewardSelectionMethod": "all",
"distributionEventId": "<string>",
"rewardAllocations": [
{
"rewardId": "<string>",
"allocationId": "<string>",
"allocationType": "assets",
"amountToDistribute": 2
}
],
"numberOfRewardsToReceive": 1
},
"createdBy": "<string>",
"updatedBy": "<string>",
"communityId": "<string>",
"featured": true,
"startsAt": "<string>",
"expiresAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Achievement
Update an achievement by id
Update an achievement by id.
POST
/
achievements
/
{id}
Update an achievement by id
curl --request POST \
--url https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"criteria": {
"type": "sum",
"parameters": {
"query": "<string>",
"attribute": "<string>",
"value": 123
}
},
"queries": [
{
"type": "event",
"alias": "<string>",
"parameters": {
"eventName": "<string>",
"eventSourceId": "<string>",
"tags": [
"<string>"
]
},
"isCommunityScoped": true
}
],
"queryDescriptions": {},
"tags": [
"<string>"
],
"campaigns": [
"<string>"
],
"startsAt": "<string>",
"expiresAt": "<string>",
"featured": true,
"isGlobalTemplate": true,
"availableAsTemplateForOrganisations": [
"<string>"
],
"communityId": "<string>",
"details": {
"title": "<string>",
"description": "<string>",
"light": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
},
"dark": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
}
}
}
'import requests
url = "https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}"
payload = {
"criteria": {
"type": "sum",
"parameters": {
"query": "<string>",
"attribute": "<string>",
"value": 123
}
},
"queries": [
{
"type": "event",
"alias": "<string>",
"parameters": {
"eventName": "<string>",
"eventSourceId": "<string>",
"tags": ["<string>"]
},
"isCommunityScoped": True
}
],
"queryDescriptions": {},
"tags": ["<string>"],
"campaigns": ["<string>"],
"startsAt": "<string>",
"expiresAt": "<string>",
"featured": True,
"isGlobalTemplate": True,
"availableAsTemplateForOrganisations": ["<string>"],
"communityId": "<string>",
"details": {
"title": "<string>",
"description": "<string>",
"light": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
},
"dark": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
}
}
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
criteria: {
type: 'sum',
parameters: {query: '<string>', attribute: '<string>', value: 123}
},
queries: [
{
type: 'event',
alias: '<string>',
parameters: {eventName: '<string>', eventSourceId: '<string>', tags: ['<string>']},
isCommunityScoped: true
}
],
queryDescriptions: {},
tags: ['<string>'],
campaigns: ['<string>'],
startsAt: '<string>',
expiresAt: '<string>',
featured: true,
isGlobalTemplate: true,
availableAsTemplateForOrganisations: ['<string>'],
communityId: '<string>',
details: {
title: '<string>',
description: '<string>',
light: {primaryImageUrl: '<string>', secondaryImageUrl: '<string>'},
dark: {primaryImageUrl: '<string>', secondaryImageUrl: '<string>'}
}
})
};
fetch('https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}",
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([
'criteria' => [
'type' => 'sum',
'parameters' => [
'query' => '<string>',
'attribute' => '<string>',
'value' => 123
]
],
'queries' => [
[
'type' => 'event',
'alias' => '<string>',
'parameters' => [
'eventName' => '<string>',
'eventSourceId' => '<string>',
'tags' => [
'<string>'
]
],
'isCommunityScoped' => true
]
],
'queryDescriptions' => [
],
'tags' => [
'<string>'
],
'campaigns' => [
'<string>'
],
'startsAt' => '<string>',
'expiresAt' => '<string>',
'featured' => true,
'isGlobalTemplate' => true,
'availableAsTemplateForOrganisations' => [
'<string>'
],
'communityId' => '<string>',
'details' => [
'title' => '<string>',
'description' => '<string>',
'light' => [
'primaryImageUrl' => '<string>',
'secondaryImageUrl' => '<string>'
],
'dark' => [
'primaryImageUrl' => '<string>',
'secondaryImageUrl' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}"
payload := strings.NewReader("{\n \"criteria\": {\n \"type\": \"sum\",\n \"parameters\": {\n \"query\": \"<string>\",\n \"attribute\": \"<string>\",\n \"value\": 123\n }\n },\n \"queries\": [\n {\n \"type\": \"event\",\n \"alias\": \"<string>\",\n \"parameters\": {\n \"eventName\": \"<string>\",\n \"eventSourceId\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"isCommunityScoped\": true\n }\n ],\n \"queryDescriptions\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"campaigns\": [\n \"<string>\"\n ],\n \"startsAt\": \"<string>\",\n \"expiresAt\": \"<string>\",\n \"featured\": true,\n \"isGlobalTemplate\": true,\n \"availableAsTemplateForOrganisations\": [\n \"<string>\"\n ],\n \"communityId\": \"<string>\",\n \"details\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"light\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n },\n \"dark\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"criteria\": {\n \"type\": \"sum\",\n \"parameters\": {\n \"query\": \"<string>\",\n \"attribute\": \"<string>\",\n \"value\": 123\n }\n },\n \"queries\": [\n {\n \"type\": \"event\",\n \"alias\": \"<string>\",\n \"parameters\": {\n \"eventName\": \"<string>\",\n \"eventSourceId\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"isCommunityScoped\": true\n }\n ],\n \"queryDescriptions\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"campaigns\": [\n \"<string>\"\n ],\n \"startsAt\": \"<string>\",\n \"expiresAt\": \"<string>\",\n \"featured\": true,\n \"isGlobalTemplate\": true,\n \"availableAsTemplateForOrganisations\": [\n \"<string>\"\n ],\n \"communityId\": \"<string>\",\n \"details\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"light\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n },\n \"dark\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.nudj.cx/api/v2/admin/achievements/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"criteria\": {\n \"type\": \"sum\",\n \"parameters\": {\n \"query\": \"<string>\",\n \"attribute\": \"<string>\",\n \"value\": 123\n }\n },\n \"queries\": [\n {\n \"type\": \"event\",\n \"alias\": \"<string>\",\n \"parameters\": {\n \"eventName\": \"<string>\",\n \"eventSourceId\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"isCommunityScoped\": true\n }\n ],\n \"queryDescriptions\": {},\n \"tags\": [\n \"<string>\"\n ],\n \"campaigns\": [\n \"<string>\"\n ],\n \"startsAt\": \"<string>\",\n \"expiresAt\": \"<string>\",\n \"featured\": true,\n \"isGlobalTemplate\": true,\n \"availableAsTemplateForOrganisations\": [\n \"<string>\"\n ],\n \"communityId\": \"<string>\",\n \"details\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"light\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n },\n \"dark\": {\n \"primaryImageUrl\": \"<string>\",\n \"secondaryImageUrl\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"organisationId": "<string>",
"details": {
"title": "<string>",
"description": "<string>",
"light": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
},
"dark": {
"primaryImageUrl": "<string>",
"secondaryImageUrl": "<string>"
}
},
"progressPeriod": "daily",
"displayMode": "default",
"tags": [
"<string>"
],
"campaigns": [
"<string>"
],
"criteria": {
"type": "sum",
"parameters": {
"query": "<string>",
"operator": "==",
"attribute": "<string>",
"value": 123
}
},
"queries": [
{
"type": "event",
"alias": "<string>",
"parameters": {
"eventName": "<string>",
"eventCategory": "achievement",
"eventSubCategory": "achievement-completion",
"eventSourceId": "<string>",
"tags": [
"<string>"
]
},
"isCommunityScoped": true
}
],
"queryDescriptions": {},
"status": "archived",
"availableAsTemplateForOrganisations": [
"<string>"
],
"isGlobalTemplate": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"rewardDistribution": {
"points": 1,
"xp": 1,
"rewardSelectionMethod": "all",
"distributionEventId": "<string>",
"rewardAllocations": [
{
"rewardId": "<string>",
"allocationId": "<string>",
"allocationType": "assets",
"amountToDistribute": 2
}
],
"numberOfRewardsToReceive": 1
},
"createdBy": "<string>",
"updatedBy": "<string>",
"communityId": "<string>",
"featured": true,
"startsAt": "<string>",
"expiresAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}Headers
Body
application/json
The input required to update an achievement
Response
Successful response
An achievement
Was this page helpful?

