Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Build a Rails API Coding the API Creating To-Do Items

why the syntax inside -d is different when creating and updating?

Ok I just need to understand something when you make the create with POST you whrite data inside -d option like this

curl -i -H "Accept:application/json" -H "Content-type:application/json" -X POST -d '{"title":"this is the title when creating"}' http://localhost:3000/api/todo_lists

but when you make the update action through PUT then you change the way you write data inside the -d option

curl -i -H "Accept:application/json" -H "Content-type:application/json" -X PUT -d '{\"title\":\"New title for this todo list\"}' http://localhost:3000/api/todo_lists/4.json

and I thought that it can be written in both ways, but I tried combinating the way of write the data and for example

-d '{\"title\":\"New title for this todo list\"}'

Did not work with the Create action. Could someone explain to me?