Update location details
curl --request PATCH \
--url https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lore": "A bustling market town.",
"name": "Rivertown",
"role": "Trade hub"
}
'import requests
url = "https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_id}"
payload = {
"lore": "A bustling market town.",
"name": "Rivertown",
"role": "Trade hub"
}
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 bustling market town.', name: 'Rivertown', role: 'Trade hub'})
};
fetch('https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_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/location/{game_id}/{world_id}/{location_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 bustling market town.',
'name' => 'Rivertown',
'role' => 'Trade hub'
]),
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/location/{game_id}/{world_id}/{location_id}"
payload := strings.NewReader("{\n \"lore\": \"A bustling market town.\",\n \"name\": \"Rivertown\",\n \"role\": \"Trade hub\"\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/location/{game_id}/{world_id}/{location_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lore\": \"A bustling market town.\",\n \"name\": \"Rivertown\",\n \"role\": \"Trade hub\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_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 bustling market town.\",\n \"name\": \"Rivertown\",\n \"role\": \"Trade hub\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Location: location789 has been updated with the following context.",
"location_id": "location789",
"location_context": {
"lore": "A bustling market town.",
"name": "Rivertown",
"role": "Trade hub"
}
}{
"message": "An error occurred"
}{
"message": "Possible reasons:\n- Location with ID [...] not found\n- Location with ID [...] not found in region [...]\n"
}{
"message": "An error occurred"
}Locations
Update location details
Update the details of an existing location. Modify fields such as lore, name, and role.
PATCH
/
context
/
location
/
{game_id}
/
{world_id}
/
{location_id}
Update location details
curl --request PATCH \
--url https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lore": "A bustling market town.",
"name": "Rivertown",
"role": "Trade hub"
}
'import requests
url = "https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_id}"
payload = {
"lore": "A bustling market town.",
"name": "Rivertown",
"role": "Trade hub"
}
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 bustling market town.', name: 'Rivertown', role: 'Trade hub'})
};
fetch('https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_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/location/{game_id}/{world_id}/{location_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 bustling market town.',
'name' => 'Rivertown',
'role' => 'Trade hub'
]),
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/location/{game_id}/{world_id}/{location_id}"
payload := strings.NewReader("{\n \"lore\": \"A bustling market town.\",\n \"name\": \"Rivertown\",\n \"role\": \"Trade hub\"\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/location/{game_id}/{world_id}/{location_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lore\": \"A bustling market town.\",\n \"name\": \"Rivertown\",\n \"role\": \"Trade hub\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.npcbuilder.com/api/context/location/{game_id}/{world_id}/{location_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 bustling market town.\",\n \"name\": \"Rivertown\",\n \"role\": \"Trade hub\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Location: location789 has been updated with the following context.",
"location_id": "location789",
"location_context": {
"lore": "A bustling market town.",
"name": "Rivertown",
"role": "Trade hub"
}
}{
"message": "An error occurred"
}{
"message": "Possible reasons:\n- Location with ID [...] not found\n- Location with ID [...] not found in region [...]\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"
The unique identifier for the location.
Example:
"location789"
Query Parameters
(Optional) The player's session ID.
Example:
"60Z5aZjIuFlyYbjbZZKe"
Body
application/json
The location data fields to update.
Response
Location updated successfully.
Confirmation message after updating the location.
Example:
"Location: location789 has been updated with the following context."
UID of the location.
Example:
"location789"
The context details of the created location.
Example:
{
"lore": "A bustling market town.",
"name": "Rivertown",
"role": "Trade hub"
}