[
https://issues.apache.org/jira/browse/NIFI-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15163867#comment-15163867
]
Fredrik Skolmli edited comment on NIFI-1543 at 2/24/16 9:55 PM:
----------------------------------------------------------------
[~mcgilman] - Thanks for the thorough comment explaining this behaviour. While
it all makes sense now knowing this, I'd suggest mentioning the importance of
both the {{Content-Type}} header as well as the {{Accept}} header, which I've
also found to be required in order to get JSON response rather than XML.
F
was (Author: frsk):
[~mcgilman] - Thanks for the thorough comment explaining this behaviour. While
it all makes sense now knowing this, I'd suggest mentioning the importance of
both the {{Content-Type}} header as well as the {{Accept}} header, which I've
also found to be required in order to get JSON response rather than XML.
- F
> Updates through Rest Api with missing Content-Type header results in
> misleading response
> ----------------------------------------------------------------------------------------
>
> Key: NIFI-1543
> URL: https://issues.apache.org/jira/browse/NIFI-1543
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 0.5.0, 0.4.1
> Reporter: Fredrik Skolmli
> Priority: Minor
> Labels: API, REST
>
> When updating an object, in this case an output port, the HTTP status code
> 409 Conflict is returned if the Content-Type header is missing. Given the
> Rest Api documentation stating that 409 is a valid request that may be
> successfull at a later time, this is misleading.
> Example without the {{Content-Type: application/json}} header.
> {code}
> yes:~/tmp/.tmp.q7s7XMNR% curl
> 'http://192.168.2.2:8080/nifi-api/controller/revision' 2> /dev/null | python
> -m json.tool
> {
> "revision": {
> "clientId": "525f9a00-75bc-4cf9-966a-43b204ba7a37",
> "lastModifier": "anonymous",
> "version": 29
> }
> }
> yes:~/tmp/.tmp.q7s7XMNR% curl -v
> 'http://192.168.2.2:8080/nifi-api/controller/process-groups/22cb7e60-e216-4b31-894b-23402113bf5d/output-ports/e290e44d-2f1e-4c93-bebe-db6b8fcb92f9'
> -X PUT --data-binary
> '{"revision":{"version":29,"clientId":"testing"},"outputPort":{"id":"e290e44d-2f1e-4c93-bebe-db6b8fcb92f9","name":"Test","comments":"","groupAccessControl":[],"userAccessControl":["uid=fredrik,ou=People,dc=example,dc=net"],"state":"STOPPED"}}'
> --compressed
>
> * Trying 192.168.2.2...
> * Connected to 192.168.2.2 (192.168.2.2) port 8080 (#0)
> > PUT
> > /nifi-api/controller/process-groups/22cb7e60-e216-4b31-894b-23402113bf5d/output-ports/e290e44d-2f1e-4c93-bebe-db6b8fcb92f9
> > HTTP/1.1
> > Host: 192.168.2.2:8080
> > User-Agent: curl/7.43.0
> > Accept: */*
> > Accept-Encoding: deflate, gzip
> > Content-Length: 238
> > Content-Type: application/x-www-form-urlencoded
> >
> * upload completely sent off: 238 out of 238 bytes
> < HTTP/1.1 409 Conflict
> < Date: Sat, 20 Feb 2016 00:15:21 GMT
> < Content-Type: text/plain
> < Transfer-Encoding: chunked
> < Server: Jetty(9.2.11.v20150529)
> <
> * Connection #0 to host 192.168.2.2 left intact
> This NiFi instance has been updated by 'anonymous'. Please refresh to
> synchronize the view.
> {code}
> New request with the {{Content-Type}} header.
> {code}yes:~/tmp/.tmp.q7s7XMNR% curl -v
> 'http://192.168.2.2:8080/nifi-api/controller/process-groups/22cb7e60-e216-4b31-894b-23402113bf5d/output-ports/e290e44d-2f1e-4c93-bebe-db6b8fcb92f9'
> -X PUT -H "Content-Type: application/json" --data-binary
> '{"revision":{"version":29,"clientId":"testing"},"outputPort":{"id":"e290e44d-2f1e-4c93-bebe-db6b8fcb92f9","name":"Test","comments":"","groupAccessControl":[],"userAccessControl":["uid=fredrik,ou=People,dc=frsk,dc=net"],"state":"STOPPED"}}'
> --compressed
> * Trying 192.168.2.2...
> * Connected to 192.168.2.2 (192.168.2.2) port 8080 (#0)
> > PUT
> > /nifi-api/controller/process-groups/22cb7e60-e216-4b31-894b-23402113bf5d/output-ports/e290e44d-2f1e-4c93-bebe-db6b8fcb92f9
> > HTTP/1.1
> > Host: 192.168.2.2:8080
> > User-Agent: curl/7.43.0
> > Accept: */*
> > Accept-Encoding: deflate, gzip
> > Content-Type: application/json
> > Content-Length: 238
> >
> * upload completely sent off: 238 out of 238 bytes
> < HTTP/1.1 200 OK
> < Date: Sat, 20 Feb 2016 00:15:45 GMT
> < Cache-Control: private, no-cache, no-store, no-transform
> < Content-Type: application/json
> < Content-Encoding: gzip
> < Vary: Accept-Encoding, User-Agent
> < Transfer-Encoding: chunked
> < Server: Jetty(9.2.11.v20150529)
> <
> * Connection #0 to host 192.168.2.2 left intact
> {"revision":{"clientId":"testing","version":30},"outputPort":{"id":"e290e44d-2f1e-4c93-bebe-db6b8fcb92f9","uri":"http://192.168.2.2:8080/nifi-api/controller/process-groups/22cb7e60-e216-4b31-894b-23402113bf5d/output-ports/e290e44d-2f1e-4c93-bebe-db6b8fcb92f9","position":{"x":107.70379100534842,"y":-960.689503119667},"parentGroupId":"22cb7e60-e216-4b31-894b-23402113bf5d","name":"Test","comments":"","state":"STOPPED","type":"OUTPUT_PORT","transmitting":false,"concurrentlySchedulableTaskCount":1,"userAccessControl":["uid=fredrik,ou=People,dc=example,dc=net"],"groupAccessControl":[]}}%
>
>
>
> yes:~/tmp/.tmp.q7s7XMNR%
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)