parameter passing to getstream info

+1 vote

Hi, I am trying to create a JSON object from the result of getstreaminfo in a PHP app.  I have tried this:    

    $getstreamitem = multichain('getstreamitem' ,        'cabe6c8e62dd625cc05815824ddd5353d7b29d471c26619751dcc550dc7b03f1', true);
     foreach ($getstreamitem as $item) {

   if (!isset($getstreamitem['getstreamitem'])) {
   
       $getstreamitem['getstreamitem'] = [];
     }
   $getstreamitem['getstreamitem'][] = $item;
}
print json_encode($getstreamitem);
echo "<br>";echo "<br>";

 

But in my output, I get:

{"result":null,"error":{"code":-8,"message":"parameter 2 must be hexadecimal string (not '')"},"id":1545517613,"getstreamitem":[null,{"code":-8,"message":"parameter 2 must be hexadecimal string (not '')"},1545517613]}

Not sure how to resolve this!

Thanks!

 

 

 

 

asked Dec 22, 2018 by tomish

1 Answer

+2 votes

I think you are forgetting to mention the stream's name in this call, for the API function goes like this:

`getstreamitem: stream, txid, (verbose=false)`

while yours is only providing txid and the optional verbose option:

multichain('getstreamitem' ,        'cabe6c8e62dd625cc05815824ddd5353d7b29d471c26619751dcc550dc7b03f1', true);

answered Dec 24, 2018 by SDVII
Thanks, that works!
...