问题
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