I don't understand the reason for this error when i want to start a stream on nifi - apache-nifi

curl -k -i -X PUT -H 'Content-Type: application/json' -d '{"id":"10d11f73-6a17-31b1-0000-000000000000","state":"RUNNING"}' http://localhost:8182/nifi-api/flow/process-groups/10d11f73-6a17-31b1-0000-000000000000
response
HTTP/1.1 404 Not Found

Related

API Platform - Dev - all requests return empty result

I have set up API platform and am trying to test the API using curl, eg.
curl -X POST -H "Content-Type: application/json" http://localhost/authentication_token -d '{"email":"test#test.com","password":"the_new_password"}'
curl http://localhost/docs
I am getting no response from the server, always blank.
Requests needed to be HTTPS, as it seems HTTP requests are simply thrown away / ignored. Add the -k flag since the certificate will be self signed and CURL will error out.
curl -X POST -H "Content-Type: application/json" https://localhost/authentication_token -d '{"email":"test#test.com","password":"the_new_password"}' -k
curl https://localhost/docs -k

How to get curl response code in a variable along with output as a file, multiple outputs needs to be appended

I am trying to get the response code of the curl command to a variable and output of the same curl command in a file. Another curl command within a different function will run and the output should append to the same output file.
response=$(curl -i -H "content-type: application/json" -w "%{http_code}" -u "$id:$cred" -H "Accept: application/json" -X POST http://sitename -d '{'<input>'}' >> out.txt
This is giving me neither the response nor the curl output in the file.
Below is working and gives me response as the desired http code though.
response=$(curl -i -H "content-type: application/json" -w "{http_code}" -u "$id:$cred" -H "Accept: application/json" -X POST http://sitename -d '{'<input>'}'
Echo $response

How to set Quiet option for Elastic Search when doing a Bulk Insert?

I can do this:
curl -s -XPOST 1.2.3.4:9200/my_index/my_index_type/_bulk -H "Content-Type: application/x-ndjson" --data-binary #/home/modified.json
But this fails:
curl -s -XPOST 1.2.3.4:9200/my_index/my_index_type/_bulk -H "Content-Type: application/x-ndjson" --data-binary #/home/modified.json --quiet
How to set 'quiet'?
Thanks.
Seems you want to Disallows non-log STDOUT output with --quiet. Let's try this way-
curl -s --quiet -XPOST 1.2.3.4:9200/my_index/my_index_type/_bulk -H "Content-Type: application/x-ndjson" --data-binary #/home/modified.json
According to the doc of --quiet,
This flag must come before any command.
If it doesn't do the job then you can use the -o switch and send the output to dev/null instead of using --quiet
curl -s -o /dev/null -XPOST 1.2.3.4:9200/my_index/my_index_type/_bulk -H "Content-Type: application/x-ndjson" --data-binary #/home/modified.json

curl command has ! character results auth failure

I am getting authentication failure error while using curl command in bash shell which password has ! char.
Below is curl command i am trying.
curl -D- -u 'some_user:somename#2019!' -X POST --data #data.txt -H 'Content-Type: application/json' https://help.myjira.com/rest/api/2/issue
I have also tried escaping ! char using \, as below, but no luck.
curl -D- -u 'some_user:somename#2019''\!' -X POST --data #data.txt -H 'Content-Type: application/json' https://help.myjira.com/rest/api/2/issue
can any one suggest.
You can try with entity code for ! = %21 (and # = %40). So:
curl -D- -u 'some_user:somename%402019%21' -X POST --data #data.txt -H 'Content-Type: application/json' https://help.myjira.com/rest/api/2/issue

Get curl http code

I have the following cURL request. I want to get the http_code, but I want in a different variable, because otherwise it messes with parsing the JSON response from the GET call.
Is there anyway to do this?
curl --write-out %{http_code} --silent --output GET --header "Accept: application/json" --header "URL"
Just use command substitution to store status code in a variable:
status=$(curl --write-out %{http_code} --silent --output tmp.out GET --header "Accept: application/json" --header "URL")
data=$(<tmp.out)
# check status now
declare -p status
# check data
declare -p data
curl -i -H "Accept: application/json" "server:5050/a/c/getName{"param0":"Arvind "}"
curl -w 'RESP_CODE:%{response_code}' -s -X POST --data '{"asda":"asd"}' http://example.com --header "Content-Type:application/json"|grep -o 'RESP_CODE:[1-4][0-9][0-9]'
response=$(curl -sb -H "Accept: application/json" "http://host:8080/some/resource") For response just try $response
Try this following may be this could help you to find the solution https://gist.github.com/sgykfjsm/1dd9a8eee1f70a7068c9

Resources