https://github.com/shawon922/django-blog-api
A simple API built with "Django Rest Framework (DRF)" for "django-blog". Here is the link of "django-blog", https://github.com/shawon922/django-blog
https://github.com/shawon922/django-blog-api
django django-rest-framework drf json-web-token pillow python python3
Last synced: about 2 months ago
JSON representation
A simple API built with "Django Rest Framework (DRF)" for "django-blog". Here is the link of "django-blog", https://github.com/shawon922/django-blog
- Host: GitHub
- URL: https://github.com/shawon922/django-blog-api
- Owner: shawon922
- License: mit
- Created: 2016-12-16T15:44:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-27T18:03:54.000Z (over 7 years ago)
- Last Synced: 2025-01-05T17:43:14.529Z (over 1 year ago)
- Topics: django, django-rest-framework, drf, json-web-token, pillow, python, python3
- Language: JavaScript
- Homepage:
- Size: 505 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-blog-api
## A simple API built with "Django Rest Framework (DRF)" for "django-blog".
### Session and Token based authentication available.
-------------------------
### To generate a Auth-token:
```
$ curl -X POST -d "username=your_username&password=your_password" http://localhost:8000/api/auth/token/
```
### To create a post, you must be authenticated. So do like this:
```
$ curl -H "Authorization: JWT " http://localhost:8000/api/posts/create
```
### To post a comment, you have to pass the following parameters:
1. slug
2. type (ex. post)
3. parent_id (optional. But if you post a reply to a comment, it's required.)
### To post a comment:
Example:
```
$ curl -X POST -H "Authorization: JWT " -H "Content-Type: application/json" -d '{"content":"This is a comment."}' 'http://localhost:8000/api/comments/create/?slug=the-slug-of-the-post&type=post'
```
### To post a reply:
Example:
```
$ curl -X POST -H "Authorization: JWT " -H "Content-Type: application/json" -d '{"content":"This is a comment."}' 'http://localhost:8000/api/comments/create/?slug=the-slug-of-the-post&type=post&parent_id=id_of_the_comment'
```