尝试使用POSTMAN

时间:2019-02-20 11:41:19

标签: rest postman hyperledger-fabric hyperledger-composer

我试图通过Playground,Composer-Rest-server和Final POSTMAN测试事务。

事务在Playground(图1和2)以及Composer-Rest-Server(图3和4)上都运行良好。但是后来我使用POSTMAN尝试了同样的操作,但出现了错误(状态码422)(图5)。

我正在使用基本样本网络。交易只是更新资产的价值。

Figure 1 - Executing Sample Transaction On Playground

Figure 2 - Updated Value of Asset #3952

Figure 3 - Executing the Transaction on the composer Rest Server

Figure 4 - Updated Value of Asset #3952 after the Rest Server Transaction

Figure 5 - Error While Using POSTMAN

错误

"error": {
    "statusCode": 422,
    "name": "ValidationError",
    "message": "The `org_example_basic_SampleTransaction` instance is not valid. Details: `asset` can't be blank (value: undefined); `newValue` can't be blank (value: undefined).",
    "details": {
        "context": "org_example_basic_SampleTransaction",
        "codes": {
            "asset": [
                "presence"
            ],
            "newValue": [
                "presence"
            ]
        },
        "messages": {
            "asset": [
                "can't be blank"
            ],
            "newValue": [
                "can't be blank"
            ]
        }
    },
    "stack": "ValidationError: The `org_example_basic_SampleTransaction` instance is not valid. Details: `asset` can't be blank (value: undefined); `newValue` can't be blank (value: undefined).\n    at ...

此错误的原因是什么,我该如何解决?

1 个答案:

答案 0 :(得分:0)

您必须以JSON格式发布数据。

enter image description here