Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

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?

share|improve this question

migrated from meta.stackoverflow.com May 8 '12 at 5:51

This question came from our discussion, support, and feature requests site for professional and enthusiast programmers.

2 Answers 2

up vote 12 down vote accepted

You'll need to quote that URL.

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

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

share|improve this answer
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.

share|improve this answer

You must log in to answer this question.