cppagent icon indicating copy to clipboard operation
cppagent copied to clipboard

Feature Request: GET/PUT endpoints for agent config + device model

Open robot-ranger opened this issue 6 months ago • 2 comments

This is an issue to track the proposal of adding GET/PUT REST routings to get&set agent config as well as devices.xml

I propose adding the following REST endpoints to cppagent:

  1. GET config: returns current cppagent config
  2. PUT/POST config: updates cppagent config
  3. (up for discussion) PUT/POST device model: updates the device model

About security: we could leverage the config elements AllowPut and AllowPutFrom, effectively restricting configuration changes to those listed in AllowPutFrom or those who already have direct access to the file system.

The agent currently restarts, per configuration, if the agent.json and/or devices.xml are modified on the filesystem.

these new endpoints would enable lightweight webapps for agent (re)configuration but in order to make this happen, we need to add GET and PUT endpoints for agent config as well as PUT endpoint for device model (the device model can already be retrieved at / or /probe

With the addition of agent config schema autocomplete suggestions and validation for agent config run right in the browser:

Image

Image

Image

robot-ranger avatar May 30 '25 01:05 robot-ranger

We can display and textually edit the device model, but unfortunately Monaco Code Editor does not have built-in schema-based autocomplete suggestions for xsd like it does for json: Image

robot-ranger avatar May 30 '25 01:05 robot-ranger

as far as security, sensitive system admins should control PUT with AllowPut and AllowPutFrom config parameters

robot-ranger avatar May 30 '25 01:05 robot-ranger