What is the syntax for an array of keys when using liststreamkeys (multichain 1.0.4)?

+1 vote

liststreamkeys allows the user to "Pass a single key in keys to retrieve information about one key only, pass an array for multiple keys, or * for all keys".

JSON syntax for an array is something like


{"name":"John",
"age":30,
"cars":[ "Ford""BMW""Fiat" ]

}"

 

But when I've tried to pass in an array of keys to search with liststreamkeys, it thinks that I'm passing in the whole thing (curly brackets and all) as the key.

 

testChain: liststreamkeys teststream {"key":"1522317920788t1t63342t3t6tFILE_ACCESStMOD_FlyBase","key":"1522000002801t1t1t1t1tREQ_RESOURCEtMOD_UCSC_Genome_Bioinformatics"}

Here's the output:

[

    {

        "key" : "{key:1522317920788t1t63342t3t6tFILE_ACCESStMOD_FlyBase,key:1522000002801t1t1t1t1tREQ_RESOURCEtMOD_UCSC_Genome_Bioinformatics}",

        "items" : 0,

        "confirmed" : 0

    }

]

I've also tried 

testChain: liststreamkeys teststream ["1522317920788t1t63342t3t6tFILE_ACCESStMOD_FlyBase","1522000002801t1t1t1t1tREQ_RESOURCEtMOD_UCSC_Genome_Bioinformatics"]

related to an answer for: Can read multiple keys of a stream?
asked Jul 27 by M.Green

1 Answer

+1 vote
 
Best answer

When using the command line you need to put single quotes around JSON array/object parameters:

liststreamkeys teststream '["key1","key2","key3"]'

This is just related to the command line and is not true if you use the JSON-RPC API directly.

answered Jul 30 by MultiChain
selected Jul 30 by M.Green
Thank you, this worked perfectly!
...