Additional HTTP Endpoints
Overview
In addition to the API functions described in Controller API Reference and External API Reference, we also have a number of simple HTTP endpoints that will allow you to get certain forms of data quickly and easily.
Finding/Changing the HTTP Port
Every time Captivate launches, it attempts to start a web server on port 9022. If that port is in use already, Captivate will fail to start properly. If something on your system needs to use that port, you can choose a different port by setting the value for Generic HTML.httpPort in the Windows Registry or in the Mac user preferences.
Mac example:
defaults write com.NewBlue.Captivate `Generic HTML.httpPort` 9099
defaults read com.NewBlue.Captivate `Generic HTML.httpPort`Note: the WebSocket port is usually
9023, but can be specified in the same way with the registry settingGeneric HTML.webSocketPort.
/temp/FOLDER/FILE.EXT
FOLDER/FILE.EXTCaptivate stores all files including images downloaded from the Internet using the downloadImage command in a temporary folder assigned by the operating system. The Captivate API can access these local files directly through the file system, but controllers can get them through regular HTTP calls to this endpoint.
Example:
const url = 'https://newbluefx.com/wp-content/uploads/2019/07/nb_logo.png';
const data = await ServiceHandler.scheduler.scheduleCommand('downloadImage', { url }, {});
/*
{
"command": "downloadImage",
"mime": "image/png",
"path": "/private/var/folders/gj/8bp694f15qb2zhl4q3l5ns700000gn/T/TitlerLive/f94ffb6f-5c98-4f46-a711-36e35f53a1c2/43ab9e0e-7c69-49cf-8530-e0f54dc9bd0e.png",
"reply": "downloadImage",
"size": "2601",
"success": true,
"tempUrl": "http://192.168.10.50:9022/temp/f94ffb6f-5c98-4f46-a711-36e35f53a1c2/43ab9e0e-7c69-49cf-8530-e0f54dc9bd0e.png",
"url": "https://newbluefx.com/wp-content/uploads/2019/07/nb_logo.png"
}
*/
console.log(data);/api/title/TITLE_ID
TITLE_IDCaptivate allows you to get the XML definition file for any title using this HTTP call. Just remember to include the curly braces as part of the TITLE_ID and urlencode them.
# Get XML for title {b960a28b-e583-4f3f-b54b-851ef481314d}
curl 'http://localhost:9022/api/title/%7Bb960a28b-e583-4f3f-b54b-851ef481314d%7D'/api/tunnel
Captivate allows you to get the information on the current websocket tunnel by making a GET request to this endpoint.
curl 'http://localhost:9022/api/tunnel'Additional NodeJS-basedased Endpoints
When Captivate runs, it launches a small nodejs-based server behind the scenes. That server also provides a few API endpoints you can access. Many of these endpoints are used by our own controllers, but they are documented here for your use too.
Using the /discover/:name endpoint
/discover/:name endpointSince Captivate uses MDNS to broadcast itself on the network and to find services it knows about, it maintains a database of discovered services and allows you to browse them easily using the API.
curl 'http://localhost:9024/discover/_googlecast._tcp.local'Last updated