1

I'm bumping my head on a simple HTTP GET request.

Using a tool like Postman, I'm getting the full and expected response (an over 1 thousand lines xml document, displaying the details of my 60 albums)

For this GET request, I provide:

  • 4 parameters embedded in the url
  • The default header "Content-Type: application/x-www-form-urlencoded"
  • 1 cookie containing my session ID, to secure my identity

Postman


With using wget however, I get only a 505 lines long xml document. As far as I know, I do provide the same cookies, same parameters and header.

wget -o logfile.log -O response.xml --load-cookies cookies.txt https://app.viewbook.com/albums/?sort=date&order=desc&page=1&per_page=500

The "response.xml" I get is a well-formed xml document, but with only 25 albums, 505 lines long:

Vim

I was thinking there might be a built-in limitation within wget, so I tried with curl


Using curl, I get exactly the same 25 limited albums, 505 lines long xml response:

curl -D filelog.log -o response.xml -H "Content-Type: application/x-www-form-urlencoded" -b "_accountservice3_session=ZFp6UU..." https://app.viewbook.com/albums/?sort=date&order=desc&page=1&per_page=500

I'm out of ideas why both wget and curl - while not totally failing - don't give the same complete result I get with the Postman tool.

Am I missing some parameters during my GET call? Where does this limited length response could come from?

  • 3
    If you 8sed exactly the lines you showed, the ampersands in the unquoted URL are treated as terminating the first command and running the subsequent commands in parallel by all common Unix shells (and also as a terminator but run in serial not parallel in WIndows CMD, but that would give an error for the command order=desc etc). – dave_thompson_085 Feb 14 at 6:49
  • @dave_thompson_085 I'm stunned! That fixed it! I forgot the ampersands has a special meaning in bash, and therefore I need to quote the whole url string. Putting the url into double quotes did fix my issue. I now have the 1000+ lines file I was looking for! Thank you so so so much. (you may add your answer so I can accept it). By the way, I'm not sure why I didn't get any error on order=desc as you said. – Yoric Feb 14 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.