chain multiple json commands

  • hi

    i would like to clear priorities for instance x,


    so i need the following two commands chained together:


    {

    "command" : "instance",

    "subcommand" : "switchTo",

    "instance" : 3

    }


    i.e. http://127.0.0.1:8090/json-rpc…To%22,%22instance%22:3%7D


    and


    {

    "command" : "clear",

    "priority" : 1

    }


    i.e. http://127.0.0.1:8090/json-rpc…ar%22,%22priority%22:1%7D



    .. alas i am too stupid to figure out the correct syntax apparently. Both commands work individually but that will only clear priority for instance 0. Advice would be much appreciated. thanks!

    • Offizieller Beitrag

    Hi pho08
    You need to execute both commands in the same session and you do it via a TCP-, Web-Socket or JSON-RPC where the command goes into the payload. You do not execute via a Query-String.


    see https://docs.hyperion-project.org/en/json/

  • as always thanks for the quick reply!


    i have read the documentation but still couldn't ifnd anything about chaining multiple commands or maybe i just misread it. could you maybe give me an example from which i can work my way towards a solution? thanks!

    • Offizieller Beitrag

    My point above re the same session had been, that e.g. if you use two curl commands then every command will be executed in one independent session and therefore the the expected chaining does not work.

    Try the following using the --next option with curl

    curl -X POST -i 'http://192.168.2.163:8090/json-rpc' --data '{"command" : "instance" , "subcommand": "switchTo", "instance" : 1}' --next -i 'http://192.168.2.163:8090/json-rpc' --data '{"command" : "clear" , "priority" : 1}'

    Alternatively, if you e.g. would open a WebSocket and then issue one or many JSON commands, it will work, as the session is the same until closure. (You could try via the WebSocket King Plug-in)

    In case you test with the FireFox RESTClient plug-in, it works too as the session is maintained.

    So it depends, which tooling on which platform you would like to use...

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!