Skip to content

Instantly share code, notes, and snippets.

@bohde
Created February 23, 2011 00:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bohde/839771 to your computer and use it in GitHub Desktop.
Save bohde/839771 to your computer and use it in GitHub Desktop.
Example of using curl and jquery with Tastypie
var data = JSON.stringify({
"user": "/api/v1/user/1",
"title": "My New Blog Post",
"body": "Something interesting should be here..."
});
$.ajax({
url: '/api/v1/entry/',
type: 'POST',
contentType: 'application/json',
data: data,
dataType: 'json',
processData: false
})
curl -d @new_blog_post.json http://localhost:8000/api/v1/entry/
{
"user": "/api/v1/user/1",
"title": "My New Blog Post",
"body": "Something interesting should be here..."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment