Flink rest api error: Request did not match expected format JarRunRequestBody

三世轮回 提交于 2019-12-24 04:10:11

问题


Trying to run a flink job remotely using the below rest api but its throwing error

curl -X POST -H 'Content-Type: application/json' --data '
{
    "type": "object",
    "id": "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarRunRequestBody",
    "properties": {
    "programArgsList" : {
      "type" : "array",
      "items" : [
        "input-kafka-server": "****",
        "input-kafka-topics": "****",
        "input-job-name": "****"

    }
  }
}
' http://x.x.x.x:8081/jars/810ac968-5d5f-450d-aafc-22655238d617.jar/run

{"errors":["Request did not match expected format JarRunRequestBody."]}

Thanks in Advance.


回答1:


The description of the request body for the jar run handler you find here is the JSON schema specification of the jar run message. What you need to specify in your request are only the properties and not the "type" and "id" fields. Thus, your request should look like:

curl -X POST -H 'Content-Type: application/json' --data '
{
  "programArgsList" : [
    "--input-kafka-server",
    "value-input-kafka-server",
    "--input-kafka-topics",
    "value-kafka-topics",
    "input-job-name",
    "value-job-name"
  ]
}
' http://x.x.x.x:8081/jars/810ac968-5d5f-450d-aafc-22655238d617.jar/run


来源:https://stackoverflow.com/questions/54348050/flink-rest-api-error-request-did-not-match-expected-format-jarrunrequestbody

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!