dijeah
dijeah

Reputation: 303

Unable to start processor using Nifi curl command

I am trying to run the below curl command to start and stop my processor in 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

But I am getting the below error:

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"])

What am I doing wrong?

Upvotes: 0

Views: 1144

Answers (1)

daggett
daggett

Reputation: 28634

see the api documentation: https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

you need to call PUT /processors/{id}/run-status

and body should be like this:

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

you also could see the correct request in your browser dev-tools

Upvotes: 1

Related Questions