Canvas
GET /canvas/:documentType
Get canvas embedded documents
Required scope: canvas:read
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| documentType | string | ✓ | params | Type of canvas document (tokens, tiles, drawings, lights, sounds, notes, templates, walls, regions) |
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | query | Scene ID to query (defaults to the active scene) | |
| documentId | string | query | Specific document ID to retrieve | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
array - Array of embedded documents
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'GET',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);
curl -X GET 'http://localhost:3010/canvas/tokens?clientId=fvtt_099ad17ea199e7e3' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/canvas/tokens'
params = {
'clientId': 'fvtt_099ad17ea199e7e3'
}
url = f'{base_url}{path}'
response = requests.get(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'get',
headers: {
'x-api-key': 'your-api-key-here'
},
url
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/canvas/tokens🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤GET /canvas/tokens🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌n❌r❌n🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "get-canvas-documents-result", "requestId": "get-canvas-documents_1778896423147", "sceneId": "tgYnjCnq6EFiREjl", "documentType": "tokens", "data": [ 0: { "actorId": "S6Nh5SfYPcyyUhRg", "x": 400, "y": 400, "shape": 4, "_id": "g0RJToymge8Rs7G2", "name": "", "displayName": 0, "actorLink": false, "delta": { 5 keys }, "width": 1, "height": 1, "texture": { 11 keys }, "elevation": 0, "sort": 0, "locked": false, "lockRotation": false, "rotation": 0, "alpha": 1, "hidden": false, "disposition": -1, "displayBars": 0, "bar1": { 1 key }, "bar2": { 1 key }, "light": { 15 keys }, "sight": { 9 keys }, "detectionModes": [], "occludable": { 1 key }, "ring": { 4 keys }, "turnMarker": { 4 keys }, "movementAction": null, "_movementHistory": [], "_regions": [], "flags": {} } ]}
GET /measure-distance
Measure the distance between two points or tokens
Calculates the distance between two positions on the canvas, respecting the grid type and measurement rules. Points can be specified as coordinates or by referencing tokens by UUID or name.
Required scope: canvas:read
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| clientId | string | query | Client ID for the Foundry world | |
| originX | number | body, query | Origin x coordinate (optional if originUuid/originName provided) | |
| originY | number | body, query | Origin y coordinate | |
| targetX | number | body, query | Target x coordinate (optional if targetUuid/targetName provided) | |
| targetY | number | body, query | Target y coordinate | |
| originUuid | string | body, query | UUID of the origin token | |
| originName | string | body, query | Name of the origin token | |
| targetUuid | string | body, query | UUID of the target token | |
| targetName | string | body, query | Name of the target token | |
| sceneId | string | body, query | Scene ID (defaults to active scene) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Distance measurement including units and grid spaces
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/measure-distance';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
originX: '0',
originY: '0',
targetX: '500',
targetY: '500'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'GET',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);
curl -X GET 'http://localhost:3010/measure-distance?clientId=fvtt_099ad17ea199e7e3&originX=0&originY=0&targetX=500&targetY=500' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/measure-distance'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'originX': '0',
'originY': '0',
'targetX': '500',
'targetY': '500'
}
url = f'{base_url}{path}'
response = requests.get(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/measure-distance';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
originX: '0',
originY: '0',
targetX: '500',
targetY: '500'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'get',
headers: {
'x-api-key': 'your-api-key-here'
},
url
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/measure-distance🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤originX=0🔤 ➡️ originX
🔤originY=0🔤 ➡️ originY
🔤targetX=500🔤 ➡️ targetX
🔤targetY=500🔤 ➡️ targetY
🔤?🧲clientId🧲&🧲originX🧲&🧲originY🧲&🧲targetX🧲&🧲targetY🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤GET /measure-distance🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌n❌r❌n🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "measure-distance-result", "requestId": "measure-distance_1778896423503", "data": { "distance": 25, "units": "ft", "origin": { "x": 0, "y": 0 }, "target": { "x": 500, "y": 500 }, "sceneId": "tgYnjCnq6EFiREjl" }}
POST /canvas/:documentType
Create canvas embedded document(s)
Required scope: canvas:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| documentType | string | ✓ | params | Type of canvas document (tokens, tiles, drawings, lights, sounds, notes, templates, walls, regions) |
| data | object | ✓ | body | Document data object or array of objects to create |
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | body, query | Scene ID to create in (defaults to the active scene) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Created document(s)
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"data": {
"x": 400,
"y": 400,
"actorId": "S6Nh5SfYPcyyUhRg"
}
})
});
const data = await response.json();
console.log(data);
curl -X POST 'http://localhost:3010/canvas/tokens?clientId=fvtt_099ad17ea199e7e3' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"data":{"x":400,"y":400,"actorId":"S6Nh5SfYPcyyUhRg"}}'
import requests
base_url = 'http://localhost:3010'
path = '/canvas/tokens'
params = {
'clientId': 'fvtt_099ad17ea199e7e3'
}
url = f'{base_url}{path}'
response = requests.post(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
json={
"data": {
"x": 400,
"y": 400,
"actorId": "S6Nh5SfYPcyyUhRg"
}
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'post',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
url,
data: {
"data": {
"x": 400,
"y": 400,
"actorId": "S6Nh5SfYPcyyUhRg"
}
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/canvas/tokens🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Request body
🔤{"data":{"x":400,"y":400,"actorId":"S6Nh5SfYPcyyUhRg"}}🔤 ➡️ body
💭 Build HTTP request
🔤POST /canvas/tokens🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 55❌r❌n❌r❌n🧲body🧲🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "create-canvas-document-result", "requestId": "create-canvas-document_1778896423071", "sceneId": "tgYnjCnq6EFiREjl", "documentType": "tokens", "data": [ 0: { "actorId": "S6Nh5SfYPcyyUhRg", "x": 400, "y": 400, "shape": 4, "_id": "g0RJToymge8Rs7G2", "name": "", "displayName": 0, "actorLink": false, "delta": { 5 keys }, "width": 1, "height": 1, "texture": { 11 keys }, "elevation": 0, "sort": 0, "locked": false, "lockRotation": false, "rotation": 0, "alpha": 1, "hidden": false, "disposition": -1, "displayBars": 0, "bar1": { 1 key }, "bar2": { 1 key }, "light": { 15 keys }, "sight": { 9 keys }, "detectionModes": [], "occludable": { 1 key }, "ring": { 4 keys }, "turnMarker": { 4 keys }, "movementAction": null, "_movementHistory": [], "_regions": [], "flags": {} } ]}
PUT /canvas/:documentType
Update a canvas embedded document
Required scope: canvas:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| documentType | string | ✓ | params | Type of canvas document (tokens, tiles, drawings, lights, sounds, notes, templates, walls, regions) |
| documentId | string | ✓ | body, query | ID of the document to update |
| data | object | ✓ | body | Object containing the fields to update |
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | body, query | Scene ID containing the document (defaults to the active scene) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Updated document
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'PUT',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"documentId": "g0RJToymge8Rs7G2",
"data": {
"x": 450,
"y": 450
}
})
});
const data = await response.json();
console.log(data);
curl -X PUT 'http://localhost:3010/canvas/tokens?clientId=fvtt_099ad17ea199e7e3' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"documentId":"g0RJToymge8Rs7G2","data":{"x":450,"y":450}}'
import requests
base_url = 'http://localhost:3010'
path = '/canvas/tokens'
params = {
'clientId': 'fvtt_099ad17ea199e7e3'
}
url = f'{base_url}{path}'
response = requests.put(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
json={
"documentId": "g0RJToymge8Rs7G2",
"data": {
"x": 450,
"y": 450
}
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'put',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
url,
data: {
"documentId": "g0RJToymge8Rs7G2",
"data": {
"x": 450,
"y": 450
}
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/canvas/tokens🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Request body
🔤{"documentId":"g0RJToymge8Rs7G2","data":{"x":450,"y":450}}🔤 ➡️ body
💭 Build HTTP request
🔤PUT /canvas/tokens🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 58❌r❌n❌r❌n🧲body🧲🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "update-canvas-document-result", "requestId": "update-canvas-document_1778896423151", "sceneId": "tgYnjCnq6EFiREjl", "documentType": "tokens", "data": [ 0: { "actorId": "S6Nh5SfYPcyyUhRg", "x": 450, "y": 450, "shape": 4, "_id": "g0RJToymge8Rs7G2", "name": "", "displayName": 0, "actorLink": false, "delta": { 5 keys }, "width": 1, "height": 1, "texture": { 11 keys }, "elevation": 0, "sort": 0, "locked": false, "lockRotation": false, "rotation": 0, "alpha": 1, "hidden": false, "disposition": -1, "displayBars": 0, "bar1": { 1 key }, "bar2": { 1 key }, "light": { 15 keys }, "sight": { 9 keys }, "detectionModes": [], "occludable": { 1 key }, "ring": { 4 keys }, "turnMarker": { 4 keys }, "movementAction": null, "_movementHistory": [], "_regions": [], "flags": {} } ]}
DELETE /canvas/:documentType
Delete a canvas embedded document
Required scope: canvas:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| documentType | string | ✓ | params | Type of canvas document (tokens, tiles, drawings, lights, sounds, notes, templates, walls, regions) |
| documentId | string | ✓ | query | ID of the document to delete |
| clientId | string | query | Client ID for the Foundry world | |
| sceneId | string | query | Scene ID containing the document (defaults to the active scene) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Deletion result
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
documentId: 'g0RJToymge8Rs7G2'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'DELETE',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);
curl -X DELETE 'http://localhost:3010/canvas/tokens?clientId=fvtt_099ad17ea199e7e3&documentId=g0RJToymge8Rs7G2' \
-H "x-api-key: your-api-key-here"
import requests
base_url = 'http://localhost:3010'
path = '/canvas/tokens'
params = {
'clientId': 'fvtt_099ad17ea199e7e3',
'documentId': 'g0RJToymge8Rs7G2'
}
url = f'{base_url}{path}'
response = requests.delete(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here'
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/canvas/tokens';
const params = {
clientId: 'fvtt_099ad17ea199e7e3',
documentId: 'g0RJToymge8Rs7G2'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'delete',
headers: {
'x-api-key': 'your-api-key-here'
},
url
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/canvas/tokens🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤documentId=g0RJToymge8Rs7G2🔤 ➡️ documentId
🔤?🧲clientId🧲&🧲documentId🧲🔤 ➡️ queryString
💭 Build HTTP request
🔤DELETE /canvas/tokens🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌n❌r❌n🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "delete-canvas-document-result", "requestId": "delete-canvas-document_1778896423184", "sceneId": "tgYnjCnq6EFiREjl", "documentType": "tokens", "success": true}
POST /move-token
Move a token to specific coordinates
Moves a token on the canvas to the specified x,y position, optionally animating through waypoints. Token can be identified by UUID or name.
Required scope: canvas:write
Parameters
| Name | Type | Required | Source | Description |
|---|---|---|---|---|
| x | number | ✓ | body, query | Target x coordinate |
| y | number | ✓ | body, query | Target y coordinate |
| clientId | string | query | Client ID for the Foundry world | |
| uuid | string | body, query | UUID of the token to move (optional if name provided) | |
| name | string | body, query | Name of the token to move (optional if uuid provided) | |
| waypoints | array | body, query | Array of waypoint objects with x and y coordinates to animate through before reaching final position | |
| animate | boolean | body, query | Whether to animate the movement (default: true) | |
| sceneId | string | body, query | Scene ID (defaults to active scene) | |
| userId | string | query, body | Foundry user ID or username to scope permissions (omit for GM-level access) |
Returns
object - Result of the token movement including new position
Try It Out
Code Examples
- JavaScript
- cURL
- Python
- TypeScript
- Emojicode
const baseUrl = 'http://localhost:3010';
const path = '/move-token';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"uuid": "Actor.S6Nh5SfYPcyyUhRg",
"x": 200,
"y": 200,
"animate": false
})
});
const data = await response.json();
console.log(data);
curl -X POST 'http://localhost:3010/move-token?clientId=fvtt_099ad17ea199e7e3' \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"uuid":"Actor.S6Nh5SfYPcyyUhRg","x":200,"y":200,"animate":false}'
import requests
base_url = 'http://localhost:3010'
path = '/move-token'
params = {
'clientId': 'fvtt_099ad17ea199e7e3'
}
url = f'{base_url}{path}'
response = requests.post(
url,
params=params,
headers={
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
json={
"uuid": "Actor.S6Nh5SfYPcyyUhRg",
"x": 200,
"y": 200,
"animate": False
}
)
data = response.json()
print(data)
import axios from 'axios';
(async () => {
const baseUrl = 'http://localhost:3010';
const path = '/move-token';
const params = {
clientId: 'fvtt_099ad17ea199e7e3'
};
const queryString = new URLSearchParams(params).toString();
const url = `${baseUrl}${path}?${queryString}`;
const response = await axios({
method: 'post',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
url,
data: {
"uuid": "Actor.S6Nh5SfYPcyyUhRg",
"x": 200,
"y": 200,
"animate": false
}
});
const data = response.data;
console.log(data);
})();
📦 sockets 🏠
💭 Emojicode HTTP Client
💭 Compile: emojicodec example.🍇 -o example
💭 Run: ./example
🏁 🍇
💭 Connection settings
🔤localhost🔤 ➡️ host
3010 ➡️ port
🔤/move-token🔤 ➡️ path
💭 Query parameters
🔤clientId=fvtt_099ad17ea199e7e3🔤 ➡️ clientId
🔤?🧲clientId🧲🔤 ➡️ queryString
💭 Request body
🔤{"uuid":"Actor.S6Nh5SfYPcyyUhRg","x":200,"y":200,"animate":false}🔤 ➡️ body
💭 Build HTTP request
🔤POST /move-token🧲queryString🧲 HTTP/1.1❌r❌nHost: localhost:3010❌r❌nx-api-key: your-api-key-here❌r❌nContent-Type: application/json❌r❌nContent-Length: 65❌r❌n❌r❌n🧲body🧲🔤 ➡️ request
💭 Connect and send
🍺 🆕📞 host port❗ ➡️ socket
🍺 💬 socket 📇 request❗❗
💭 Read and print response
🍺 👂 socket 4096❗ ➡️ data
😀 🍺 🔡 data❗❗
💭 Close socket
🚪 socket❗
🍉
Response
Status: 200
{ "type": "move-token-result", "requestId": "move-token_1778896423481", "data": { "tokenUuid": "Scene.tgYnjCnq6EFiREjl.Token.TOInpAfNZ6GRAJaG", "name": "Updated Test Actor", "x": 200, "y": 200, "sceneId": "tgYnjCnq6EFiREjl" }}