Rest API
VNyan has a generic Rest API-functionality that allows receving payloads through POST and GET-messages. The API listens port 8069 so messages that are sent to address http://localhost:8069
The port of the Rest API can be changed by going to Settings -> Misc and changing the value of the REST API Port-field.
The API uses no authentication so make sure the API port is not opened to the public internet.
Messages sent to the VNyan API can be handled with the API Message-node. This means that the users build the API operations themselves.
POST Message Format
{
"action": "ActionName",
"payload":
{
"value1": "Nyaa",
"nyan2": "Nyannyan",
"someothervalue": "nyanyannyan"
}
}
GET Message Format
For GET-messages the parameters need to be included in the query string. Action must be specified with action-parameter. Everything else will be mapped to the dictionary as keys and values.
For example: http://localhost:8069/?action=ActionName&value1=Nyaa
Example
A simple example to use the API would be to trigger the Spinner-node with a value specified in the payload.
VNYANGRAPH:dFIeQVBJIFNwaW4eMR4wHi04NzgfMTQeOTQ1HzQ1MRxZaB5BUElNZXNzYWdlHnRSHjAeLTc1OR8tMTM2HmFjdGlvbh9zcGluH2RpY3QfHVVCHlNwaW5uZXIedFIeMB4tNDgfLTE3MB5zcGluUG93ZXIfHTlmHkRpY3Rpb25hcnlWYWx1ZR50Uh4wHi01MDUfLTMyMR5hcnJheR8fa2V5H3NwZWVkHTlCHlRleHRUb0RlY2ltYWwedFIeMB4tMjc0Hy0zMDgedGV4dB8cVUIwH1loMB05ZjAfWWgyHjlCMB85ZjAeVUIwHzlCMA
This node graph example could be triggered by sending the following POST-message to the API:
{
"action": "spin",
"payload":
{
"speed": "10",
}
}