Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vfdev-5/testrestapi
A test rest api with DRF
https://github.com/vfdev-5/testrestapi
Last synced: 11 days ago
JSON representation
A test rest api with DRF
- Host: GitHub
- URL: https://github.com/vfdev-5/testrestapi
- Owner: vfdev-5
- Created: 2015-09-01T16:09:47.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-01T22:03:26.000Z (about 9 years ago)
- Last Synced: 2024-10-13T12:12:02.225Z (26 days ago)
- Language: Python
- Size: 539 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test REST Api
Example of REST Api with users
- Django
- Django REST Framework
- ...## API description :
The api stores photos/comments that authenticated users can upload to the api.
#### Any user can request all images
(GET) /api/photo/or a particular image by its id, e.g:
(GET) /api/photo/1/
#### Any user can request all comments
(GET) /api/comment/#### Authenticated user can get its token (using CURL):
curl -X POST
-H 'Content-Type: application/json'
-d '{"username":"your_username", "password":"your_password"}'
/api/auth-token/The response looks like :
{"token":"20bc9.......82ee"}#### An authenticated user can upload an image:
curl -S /api/photo/
-F "image=@/path/to/file.jpg;filename=uploaded_file_name.jpg;type=image/*"
-H 'Authorization: Token '#### An authenticated user can create a comment:
curl -X POST
-H 'Content-Type: application/json'
-d '{"comment":"This is another test comment created by a user"}'
-H 'Authorization: Token '
/api/comment/