Невозможно запустить процессор с помощью команды Nifi curl - PullRequest
0 голосов
/ 26 апреля 2019

Я пытаюсь запустить приведенную ниже команду curl, чтобы запустить и остановить мой процессор в Nifi:

curl -i -H 'Content-Type: application/json' -XPUT -d '{"id":"016a1048-82dc-1262-fc26-ffcac4e76c1a","status":"Running"}' http://localhost:9090/nifi-api/processors/016a1048-82dc-1262-fc26-ffcac4e76c1a

Но я получаю следующую ошибку:

HTTP/1.1 400 Bad Request
Date: Fri, 26 Apr 2019 07:41:09 GMT
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
Content-Type: text/plain
Vary: Accept-Encoding
Content-Length: 423
Server: Jetty(9.4.11.v20180605)

Cannot construct instance of `org.apache.nifi.web.api.dto.status.ProcessorStatusDTO` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('Running')
 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 55] (through reference chain: org.apache.nifi.web.api.entity.ProcessorEntity["status"])

Что яделаешь неправильно?

1 Ответ

1 голос
/ 26 апреля 2019

см. Документацию по API: https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

вам нужно позвонить PUT /processors/{id}/run-status

, а тело должно выглядеть следующим образом:

{
    "revision": {
        "clientId": "value",
        "version": 0,
        "lastModifier": "value"
    },
    "state": "value",
    "disconnectedNodeAcknowledged": true
}

youтакже мог видеть правильный запрос в вашем браузере dev-tools

...