I'm writing data into a Rails model, using Python to send the JSON (to demonstrate I created a simple scaffold Book
with a title and price):
import json, urllib2
httpHeaders = {'Content-Type': 'application/json', 'Accept': 'application/json'}
bookData = {"title": "blah", "price":5}
req = urllib2.Request("http://localhost:3000/books.json", json.dumps({"book": bookData}), httpHeaders)
response = json.loads(urllib2.urlopen(req).read())
This inserts the book and gives it ID = 1:
# http://localhost:3000/books/1.json
{"id": 1,"title": "blah","price": 5}
How can I now edit this record via JSON, for example to change the price?