Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vfdev-5/testrestapi2
Another test REST Api
https://github.com/vfdev-5/testrestapi2
Last synced: 11 days ago
JSON representation
Another test REST Api
- Host: GitHub
- URL: https://github.com/vfdev-5/testrestapi2
- Owner: vfdev-5
- Created: 2015-09-01T23:06:35.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-04T06:49:11.000Z (about 9 years ago)
- Last Synced: 2024-10-13T12:21:15.283Z (26 days ago)
- Language: Python
- Size: 676 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/### Useful info
On OAuth2 :aaronpk : an-introduction-to-oauth2
In case of
HTTPError 403 (Forbidden) with Django and python-social-auth connecting to Google with OAuth2Catch AuthCanceled exception :
http://stackoverflow.com/questions/20907276/python-social-auth-authcanceled-exception### TODO
03/09/2015- OK = Login as github/google user using a link from test html
- OK = Logout user using a link from test html
- OK = Display Login/Logout options on the test html
- OK = Convert 3rd party token to my Api token04/09/2015
Client side :
- Obtain user details from 3rd party social oauth resource using AJAX
- Convert tokens using AJAX