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

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?