🖼️

Scenes

Created
Jun 7, 2021 11:05 AM
Tags
Description
Documentation regarding the retrieval and updates of overlays
The scenes API allows you to retrieve info about scenes, as well as update specific settings of scene components

Base URL

All of the routes to follow will be based on the base URL:
https://api2.pixelchat.tv/public

List Scenes

Route

/scenes

Methods

GET

Response

{
	"4ea50b39-6912-4d21-b5e9-3d473129c657": { // This key is the SceneId
    "components": {
      "0a0b388e-6d09-4ba9-adbe-c5ecefcfc8a8": { //This key is the componentId
        "type": "overlay",
        "x": 9.352735504699549,
        "y": 4.253472222222222,
        "width": 43.8303,
        "height": 42.4658,
        "isLocked": false,
        "hidden": false,
        "component": "cc9f3ba6-463e-4f50-a17c-a31b8fb11494" //this is the component
				//For overlay components this is an overlayId, for images it's an upload Key,
				//and for external URL components, it's a link
      }
			//other components
    },
    "settings": {
      "title": "My Main Scene",
      "width": 1920,
      "height": 1080
    },
    "order": [ //This is the z-index order of the components, by componentId
      "0a0b388e-6d09-4ba9-adbe-c5ecefcfc8a8",
    ]
  }
}

JavaScript Fetch Example

const req = await fetch(`https://api2.pixelchat.tv/public/scenes`, 
	{
		headers: {
			"x-api-key": "asdf12344321fdsa"
		}
	}
)

const res = await req.json();

console.log(res)

Get Scene

Route

/scenes/[sceneId]

Methods

GET

Response

{
  "components": {
    "0a0b388e-6d09-4ba9-adbe-c5ecefcfc8a8": { //This key is the componentId
      "type": "overlay",
      "x": 9.352735504699549,
      "y": 4.253472222222222,
      "width": 43.8303,
      "height": 42.4658,
      "isLocked": false,
      "hidden": false,
      "component": "cc9f3ba6-463e-4f50-a17c-a31b8fb11494" //this is the component
			//For overlay components this is an overlayId, for images it's an upload Key,
			//and for external URL components, it's a link
    }
		//other components
  },
  "settings": {
    "title": "My Main Scene",
    "width": 1920,
    "height": 1080
  },
  "order": [ //This is the z-index order of the components, by componentId
      "0a0b388e-6d09-4ba9-adbe-c5ecefcfc8a8",
   ]
}

JavaScript Fetch Example

const req = await fetch(`https://api2.pixelchat.tv/public/scenes/asd-asd-asd`, 
	{
		headers: {
			"x-api-key": "asdf12344321fdsa"
		}
	}
)

const res = await req.json();

console.log(res)

Edit Scene Component

Route

/scenes/[sceneId]/components/[componentId]

Methods

PATCH

PATCH

Body

This is the template for the body to update an component setting. Currently you can only update the hidden state of a component. In the future you will be able to update position, size, and locked state as well.
{
	"hidden": true
}

Response Codes

200 | 404 | 406

Response

{
	"status": "success" | "error",
	"error"?: "Invalid setting" //this will only be provided if an error occurred
}

JavaScript Fetch Example

const req = await fetch(`https://api2.pixelchat.tv/public/scenes/asd-asd-asd/components/dsa-dsa-dsa`, 
	{
		headers: {
			"x-api-key": "asdf12344321fdsa",
			"Content-Type": "application/json"
		},
		method: "PATCH",
		body: JSON.stringify({hidden: true})
	}
)

const res = await req.json();

console.log(res)