How to delete a component via the JSON-RPC?

Hi everybody,

I want to configure the components of my edge via the JSON-RPC with websocket.

Now I can use {“method”: “createComponentConfig”} to create a new component, but I don’t know how to delete it via JSON-RPC.

Are there any more detailed documents that I can refer to study for configuate via JSON-RPC?

Thank you in advance!

1 Like

Hello alantrue,

please have a look into the Json RPC Handler here RestHandler:handleJsonRpcRequest().
This is where a JSON-RPC request will be evaluated. In line 494 you find the “createComponentConfig” handler This is what you already use. It is the constant value of CreateComponentConfigRequest.METHOD . If you check all the other ..Request.METHOD constants you find the DeleteComponentConfigRequest.METHOD in line 500. The implementation is located here
DeleteComponentConfigRequest.Typically the documentation of the implementation gives you a hint how to use it. In your case it should go like this:

{
    "jsonrpc": "2.0",
    "id": "UUID",
    "method": "deleteComponentConfig",
    "params": {
      "componentId": <the id of the component to delete>
    }
 }

Within the Resthandler you may find other useful methods, for example updateComponentConfig to change the configuration of an existing component.

Chris

2 Likes

Thanks, It’s very helpful!