Update world details
curl --request PATCH \
--url https://app.npcbuilder.com/api/context/world/{game_id}/{world_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lore": "A world where magic and technology coexist.",
"name": "Eldoria",
"creatures": "Dragons, Elves",
"similarWorlds": [
"Middle Earth"
]
}
'import requests
url = "https://app.npcbuilder.com/api/context/world/{game_id}/{world_id}"
payload = {
"lore": "A world where magic and technology coexist.",
"name": "Eldoria",
"creatures": "Dragons, Elves",
"similarWorlds": ["Middle Earth"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lore: 'A world where magic and technology coexist.',
name: 'Eldoria',
creatures: 'Dragons, Elves',
similarWorlds: ['Middle Earth']
})
};
fetch('https://app.npcbuilder.com/api/context/world/{game_id}/{world_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://app.npcbuilder.com/api/context/world/{game_id}/{world_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'lore' => 'A world where magic and technology coexist.',
'name' => 'Eldoria',
'creatures' => 'Dragons, Elves',
'similarWorlds' => [
'Middle Earth'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.npcbuilder.com/api/context/world/{game_id}/{world_id}"
payload := strings.NewReader("{\n \"lore\": \"A world where magic and technology coexist.\",\n \"name\": \"Eldoria\",\n \"creatures\": \"Dragons, Elves\",\n \"similarWorlds\": [\n \"Middle Earth\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://app.npcbuilder.com/api/context/world/{game_id}/{world_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lore\": \"A world where magic and technology coexist.\",\n \"name\": \"Eldoria\",\n \"creatures\": \"Dragons, Elves\",\n \"similarWorlds\": [\n \"Middle Earth\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.npcbuilder.com/api/context/world/{game_id}/{world_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lore\": \"A world where magic and technology coexist.\",\n \"name\": \"Eldoria\",\n \"creatures\": \"Dragons, Elves\",\n \"similarWorlds\": [\n \"Middle Earth\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "World: world456 has been updated with the following context.",
"world_id": "world456",
"world_context": {
"lore": "A world where magic and technology coexist.",
"name": "Eldoria",
"creatures": "Dragons, Elves",
"similarWorlds": [
"Middle Earth"
]
}
}{
"message": "An error occurred"
}{
"message": "Possible reasons:\n- World with ID [...] not found\n"
}{
"message": "An error occurred"
}Worlds
Update world details
Update the details of an existing world. Modify fields such as lore, name, creatures, and similar worlds.
PATCH
/
context
/
world
/
{game_id}
/
{world_id}
Update world details
curl --request PATCH \
--url https://app.npcbuilder.com/api/context/world/{game_id}/{world_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lore": "A world where magic and technology coexist.",
"name": "Eldoria",
"creatures": "Dragons, Elves",
"similarWorlds": [
"Middle Earth"
]
}
'import requests
url = "https://app.npcbuilder.com/api/context/world/{game_id}/{world_id}"
payload = {
"lore": "A world where magic and technology coexist.",
"name": "Eldoria",
"creatures": "Dragons, Elves",
"similarWorlds": ["Middle Earth"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lore: 'A world where magic and technology coexist.',
name: 'Eldoria',
creatures: 'Dragons, Elves',
similarWorlds: ['Middle Earth']
})
};
fetch('https://app.npcbuilder.com/api/context/world/{game_id}/{world_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://app.npcbuilder.com/api/context/world/{game_id}/{world_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'lore' => 'A world where magic and technology coexist.',
'name' => 'Eldoria',
'creatures' => 'Dragons, Elves',
'similarWorlds' => [
'Middle Earth'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.npcbuilder.com/api/context/world/{game_id}/{world_id}"
payload := strings.NewReader("{\n \"lore\": \"A world where magic and technology coexist.\",\n \"name\": \"Eldoria\",\n \"creatures\": \"Dragons, Elves\",\n \"similarWorlds\": [\n \"Middle Earth\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://app.npcbuilder.com/api/context/world/{game_id}/{world_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lore\": \"A world where magic and technology coexist.\",\n \"name\": \"Eldoria\",\n \"creatures\": \"Dragons, Elves\",\n \"similarWorlds\": [\n \"Middle Earth\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.npcbuilder.com/api/context/world/{game_id}/{world_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lore\": \"A world where magic and technology coexist.\",\n \"name\": \"Eldoria\",\n \"creatures\": \"Dragons, Elves\",\n \"similarWorlds\": [\n \"Middle Earth\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "World: world456 has been updated with the following context.",
"world_id": "world456",
"world_context": {
"lore": "A world where magic and technology coexist.",
"name": "Eldoria",
"creatures": "Dragons, Elves",
"similarWorlds": [
"Middle Earth"
]
}
}{
"message": "An error occurred"
}{
"message": "Possible reasons:\n- World with ID [...] not found\n"
}{
"message": "An error occurred"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier for the game.
Example:
"game123"
The unique identifier for the world.
Example:
"world456"
Query Parameters
(Optional) The player's session ID.
Example:
"60Z5aZjIuFlyYbjbZZKe"
Body
application/json
The world data fields to update.
Response
World updated successfully.
Confirmation message after updating the world.
Example:
"World: world456 has been updated with the following context."
UID of the world.
Example:
"world456"
The context details of the created world.
Example:
{
"lore": "A world where magic and technology coexist.",
"name": "Eldoria",
"creatures": "Dragons, Elves",
"similarWorlds": ["Middle Earth"]
}
⌘I