Created
February 23, 2011 00:47
-
-
Save bohde/839771 to your computer and use it in GitHub Desktop.
Example of using curl and jquery with Tastypie
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -d @new_blog_post.json http://localhost:8000/api/v1/entry/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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