首页 文章

Hyperledger Composer Playground查询

提问于
浏览
1

我们可以使用Hyperledger Composer Playground进行查询,还是只能使用REST API进行查询?我阅读了本教程,但它只展示了如何使用REST API进行查询 .

2 回答

  • 0

    正如Pronoy所说,您可以使用REST API . 另一种方法是设置一个事务,调用定义的查询(在查询中,qry) - 纯粹用于测试和记录消息等 .

    return query('selectPerson', {firstName: 'joe'} )
        .then(function (results) {
    
           for (var n = 0; n < results.length; n++) {
                   var person = results[n];
                   console.log('person is ' + (n+1) + ', object is ' +  person);
                   console.log('person identifier is ' + person.getIdentifier());
    
             return personRegistry.get(person.getIdentifier())
             .then(function (personRecord) {
                console.log('object is ' + personRecord); // all good
               console.log('identifier is ' + person.getIdentifier() );
             })
    
    
    
           } // for
    
      }) //function
    
  • 0

    您无法使用Playground执行HTTP请求,但可以测试网络中的所有事务和资产 . 使用REST API,您可以执行HTTP请求以及CRUD网络中的所有事务和资产 .

相关问题