If I try to access the following from firefox everything works even if I'm not logged in



wget http://api.stackexchange.com/2.0/users/19068?order=desc&sort=reputation&site=stackoverflow


Resolving api.stackexchange.com...
Connecting to api.stackexchange.com||:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
2012-05-08 01:46:49 ERROR 400: Bad Requ

Why do I get an error message?


You'll need to quote that URL.

wget 'http://api.stackexchange.com/2.0...&site=stackoverflow'
     ^                                                      ^

(And note that the payload is gzip-compressed.)

| improve this answer | |
  • 4
    For technical reference, this happens because the & in the URL signifies to the shell to start a new background process and run the code following that. – dunsmoreb May 7 '12 at 22:00

The problem is the & characters in the URL. In most shells, foo & bar means "start running foo in the background while running bar in the foreground". Put quotes around the URL to make sure it gets passed as a single parameter to wget.

| improve this answer | |

You must log in to answer this question.