Web / HTTP API
  
  
 
      Introduction #
Notch Blocks and Standalone Executables provide a webserver that allows exposed properties to be controlled via HTTP GET requests. This functionality primarily drives the Web GUI, but can also be used by 3rd party applications & web services.
How to enable the Web API in your project #
To enable the Web API follow the instructions for enabling the Web GUI.
API Description #
All calls listed below should be made via:
- HTTP GET
- Utilising the HTTP port specified in the Project Settings
e.g. http://127.0.0.1:8910/control
Retrieving a manifest of exposed parameters #
Calling /control will return a JSON manifest of the exposed properties. An example below:
{
	"controls": [
		{
			"enums": [
				"Deferred Lighting" 
			],
			"groupName": "",
			"name": "Notch Layer",
			"type": "Enum",
			"uniqueId": "layerlayerlayer",
			"value": "" 
		},
		{
			"groupName": "3D Object",
			"max": 1.964810013771057,
			"min": 0,
			"name": "Position X",
			"type": "Float",
			"uniqueId": "Position X::Transform::ee54699e-8bc2-11e6-895a-002590e7589b",
			"value": "1.964810" 
		}
	],
	"protocolVersion": "100" 
}
The Layer attribute will always be shown in the manifest.
Setting an Exposed Properties value #
To set an Exposed Properties value call: /control?uid=<your_uniqueid>&value=<your_value>
- URL: /control
- Parameters:
- uid: The uniqueId (URL escaped) as provided by the JSON manifest (above) and viewable in the Notch Builder when you exposed the property.
- value: The value you wish to set. If setting text strings, then URL escape the string.
 
Examples:
| Param Type | URL Syntax | 
|---|---|
| Text | http://127.0.0.1:8910/control?uid=Text+String%3A%3AAttributes%3A%3A7f9b7203-30d8-11e7-b0fa-b88a60f6d91a&value=Hello%20World | 
| Float | http://127.0.0.1:8910/control?uid=Position+X%3A%3ATransform%3A%3Aee54699e-8bc2-11e6-895a-002590e7589b&value=0.6955427448749542 | 
| Colour (RGBA) | http://127.0.0.1:8910/control?uid=Colour%3A%3AMaterial%3A%3Afb679e90-8bc2-11e6-895a-002590e7589b&value=0.1881285057810822%2C1%2C0.30517378671806084%2C1.000000 | 

