Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

APIs

Toms Viksna
Toms Viksna
161 Points

curl -H "Authorization: apikey mykey" https://....lists/55145lol6 (23) Failed writing body

""""curl -H "Authorization: apikey mykey" https://us18.api.mailchimp.com/3.0/lists/551452lol8 | json""""

DOnt know why i m getting this

-bash: json: command not found % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5559 100 5559 0 0 13249 0 --:--:-- --:--:-- --:--:-- 13235 (23) Failed writing body

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

The "|" character is called a pipe in a terminal/shell. When you type cmd1 | cmd2 into a shell it means "use the output of cmd1 as the input for cmd2". So by using curl ... | json you are taking the response from the curl request and piping it into a command named json. However there is no such command in the standard shell environments so it causes an error. Since you haven't said what you're trying to accomplish we can't help you much further but you can always save the response to a file with the > character and process it later: curl ... >response.json

Toms Viksna
Toms Viksna
161 Points

I just want to output list in json format. Nothing else