HTTP Bridge
PixelCore HTTP Bridge is a component which provides a simple and straightforward way to inject data into the Platform using HTTP POST requests. Using this component one can easily initiate data injection and execution of RPC calls. This feature also enabled easy scripting, PoC and testing.
Overview¶
HTTP Bridge essentially exposes TCP port which accepts HTTTP connections and require HTTP basic authorization to be passed. Authorisation can be configured via changing the corresponding properties of the HTTP Bridge Object in PixelAdmin Application or via GraphQL API. Once the Authorisation is validated HTTP Bridge accepts two major types of requests:
- request to update properties of the object and
- request to execute an RPC call of the object (regular and stealth RPCs are supported)
Posting data into an object¶
Below you may find a format of the HTTP POST request which allows one to update properties of the existing object within the Platform. One would need to provide Object's UUID and selected properties with new values. This is easily can be found with the help of PixelAdmin application.
POST /<OBJECT_UUID>/properties
As a contents of the HTTP POST request one need to provide a JSON array of objects in the following format:
[
{
"<group_name_1/property_name_1>": "value",
"<group_name_1/property_name_2>": "value",
"<group_name_2/property_name_1>": "value"
},
{
"<group_name_3/property_name_1>": "value",
"<group_name_3/property_name_2>": "value",
"<group_name_4/property_name_1>": "value"
}
...
]
Each JSON object within an array would be interpreted as a single transaction and would have same unique transaction ID automatically assigned by HTTP Bridge. There is no limitations on combination of Properties from different Groups. If the Group/Property pair is not found within the corresponding object it would be simply ignored. The properties of the object would updated using updateObjectProperties GraphQL API call executed once or multiple times. If Object UUID is not found, HTTP POST would return an error code.
Calling RPC¶
Using different HTTP POST method one can initiate an RPC (Control) call for corresponding Object within the Platform. Below you may find a format of the HTTP POST request which allows one to do this. One would need to provide Object's UUID, RPC method name and valid parameters for the call. This is easily can be found with the help of PixelAdmin application.
- For Regular RPC call:
POST /<OBJECT_UUID>/control - For Stealth RPC call:
POST /<OBJECT_UUID>/control/stealth
Please check the documentation for RPC mechanism implementation first in this section: Controls/RPC.
As a contents of the HTTP POST request one need to provide a JSON object in the following format:
{
"rpc": "NameOfRpc",
"timeout": "30"
"params": {
"parameter1": "value1",
"parameter2": "value2",
"parameter3": "value3"
...
}
}
The call would be initiated via createControlsExecution or createControlsExecutionStealth GraphQL API calls. Parameters would be passed as is to the params field. For Regular RPC call the HTTP POST would block until the execution is not finished or timeout has expired (timeout field, expressed in seconds) and would report all the intermediary statuses reported by the module which is responsible for the call execution. For Stealth RPC call (due to its nature) the connection would be closed without any status reporting.