Hi all,
I've a problem in order to perform an HTTP GET request by nsis..
I should perform this request with a parameter, that will be a json. Now, I've made the json with the correct values, but I don't know how can I perform the GET request.. any ideas?!?
Thanks so much! 👍
HTTP GET request
20 posts
This is not really a NSIS question.
How you pass the data will depend on the server but in general you should probably use POST if you are sending JSON to the server...
How you pass the data will depend on the server but in general you should probably use POST if you are sending JSON to the server...
Ok, but there is a syntax to do a POST or a GET with NSIS?!
For JSON post:
Not sure how to set Content-Type as application/jsonrequest with this plugin though...
/HEADERS probably...Originally Posted by jpderuiter View PostNot sure how to set Content-Type as application/jsonrequest with this plugin though...
The /HEADER parameter is not available for post (at least not mentioned on the wiki page).
So.. I'm confused.. Now I'm going to try with this plugin... waiting for updates!
I would assume that /HEADER works with post but to find out for sure you would either have to just test or take a look at the source code...
It's an hardest world, NSIS world... 🙁
I just checked in the source code, /HEADER parameter is available for post, so you could try that.
Thanks! I'm going to try...
So.. I've problems again..
I'm trying to use post:
I would like to exclude that the post syntax is uncorrect, could you confirm it?
I'm trying to use post:
and I've trapped the return error with:
inetc:😛ost /header \
"Host 127.0.0.1:4488 \
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 \
Content-Type application/json; charset=UTF-8" \
/file c:\Temp\test.json \
"http://127.0.0.1:4488/"
and it returns: "Connection Error".
Pop $1 # return value = exit code, "OK" if OK
MessageBox MB_OK "Status: $1"
I would like to exclude that the post syntax is uncorrect, could you confirm it?
I don't think you should add the Host header, the plugin/WinINet will probably add it. You probably also need to add $\r$\n for each header.
Do you get connection error if you don't use /header?
Do you get connection error if you don't use /header?
Without /header I obtain "parts error"...
So in this moment I'm trying with :
Thanks!
So in this moment I'm trying with :
but it doesn't work correctly.. what do you mean with $\r$\n ??inetc:😛ost /header "Content-Type:application/json" "$jSonTree" "http://127.0.0.1:4488" "$output" /end
Thanks!
Sorry, I want to say that I obtain File Open Error
but which file???
but which file???
Ok with this call:
the inetc:😛ost works?? Someone else using this method?!
I've tried to simulate my call with wget, using a file containing my json:
Any ideas?! 🧟😐😱
it works and after do that, the return value of the post is "OK", but... if I try to analyze the traffic on 4488 port.. nothing!inetc:😛ost /header "Content-Type:application/json" "$jSonTree" "http://127.0.0.1:4488" /end
the inetc:😛ost works?? Someone else using this method?!
I've tried to simulate my call with wget, using a file containing my json:
and it works!C:\Utilities\GnuWin32\bin\wget.exe -v --header=Content-Type:application/json --post-file C:\Temp\test.json http://127.0.0.1:4488
Any ideas?! 🧟😐😱
You could try Wireshark...
Yeah, I've already thought this.. and traffic doesn't pass from localhost:4488... :-(
I don't know... 🙁 any ideas?
I've seen in the source code that post calls directly the get fuction... now i'm trying to use directly get.. but... I don't know if it is a good idea...
I don't know... 🙁 any ideas?
I've seen in the source code that post calls directly the get fuction... now i'm trying to use directly get.. but... I don't know if it is a good idea...
You could try a different server, I believe there are some online services that allow you to test this kind of stuff by responding with the headers and post data in their returned page, or just run the server on a different machine...
but with wget works with this server...
I'm going to search a test server...
thanks for the patience!
I'm going to search a test server...
thanks for the patience!