用于发送命令的 Wolkenkit REST API 返回"Malformed command"



我正在尝试使用Wolkenkit的REST API发送命令。我没有在文档中找到任何信息,因此我尝试通过浏览源代码和单元测试来找到必要的信息。

我正在使用httpie来执行CLI的请求:

> http --verbose post https://local.wolkenkit.io:3500/v1/command id=12bf5b37-e0b8-42e0-8dcf-dc8c4aefc000 context:='{"name": "mycontext"}' aggregate:='{"name": "label", "id": "26c01e1f-abb8-42fa-82cf-60ca4a6bfbfa"}' name=create data:='{"label": "third"}' custom:='{}' metadata:='{"timestamp": "1504167240279", "correlationId": "12bf5b37-e0b8-42e0-8dcf-dc8c4aefc000", "causationId": "12bf5b37-e0b8-42e0-8dcf-dc8c4aefc000"}'
POST /v1/command HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 405
Content-Type: application/json
Host: local.wolkenkit.io:3500
User-Agent: HTTPie/0.9.9
{
    "aggregate": {
        "id": "26c01e1f-abb8-42fa-82cf-60ca4a6bfbfa",
        "name": "label"
    },
    "context": {
        "name": "mycontext"
    },
    "custom": {},
    "data": {
        "label": "third"
    },
    "id": "12bf5b37-e0b8-42e0-8dcf-dc8c4aefc000",
    "metadata": {
        "causationId": "12bf5b37-e0b8-42e0-8dcf-dc8c4aefc000",
        "correlationId": "12bf5b37-e0b8-42e0-8dcf-dc8c4aefc000",
        "timestamp": "1504167240279"
    },
    "name": "create"
}
HTTP/1.1 400 Bad Request
Access-Control-Allow-Origin: *
Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate
Connection: keep-alive
Content-Length: 18
Content-Type: text/html; charset=utf-8
Date: Wed, 30 Aug 2017 20:57:27 GMT
ETag: W/"12-2BIyYXjsDfNWq9+GqVAfSCeA8D4"
Expires: 0
Pragma: no-cache
Surrogate-Control: no-store
X-FRAME-OPTIONS: DENY
X-Powered-By: Express
X-XSS-Protection: 1; mode=block
Malformed command.

我使用Wolkenkit控制台验证aggregate.id是否正确。command.id只是随机uuid()

Malformed command作为响应我错了什么?

免责声明:我是Wolkenkit的开发人员之一。

在内部,这些命令是使用命令 - 事件模块构建的,该模块也用于验证传入命令。

实际错误来自沃尔肯基特(Wolkenkit)在引擎盖下用作使用命令和事件的应用程序的基础的尾风。在内部,此代码调用commands-eventsisWellformed函数,该功能依次检查命令的模式。

从我看到的一切似乎都很好,除了metadata.timestamp应该是number,而不是string。我认为,如果您更改此操作,那么Wolkenkit将快乐地接受您的命令。

最新更新