我設置了一個簡單的新的應用程序與模型條目,使用腳手架屬性title
和content
。將JSON數據發送到簡單的應用程序與捲曲
現在我正在嘗試使用curl POST POST JSON數據(而不是使用瀏覽器)。
以下似乎工作(即成功發佈以空數據):
curl --verbose --header "Accept: application/json" --header "Content-type: application/json" --request POST --data "" http://localhost:3000/entries
下不起作用:
curl --verbose --header "Accept: application/json" --header "Content-type: application/json" --request POST --data "{'content':'I belong to AAA','title':'AAA'}" http://localhost:3000/entries
我已經嘗試了許多變化。我得到的錯誤大多是主機未找到或JSON數據的意外標記。
問題解決。非常感謝。喬納森確實讓我們開始了正確的軌道。謝謝。 – delta2006