Summer of Code/2013/moksaya: Difference between revisions
Rahul Gaur (talk | contribs) |
Rahul Gaur (talk | contribs) |
||
| Line 328: | Line 328: | ||
|} | |} | ||
==== | ==== Likes ==== | ||
{| class="wikitable" | |||
|- | |||
! Resource !! Description | |||
|- | |||
| POST /api/v1/liking/ || Making http post request to this Resource along with the json data with user field containing resource_uri of the currently logged in user and liking_content_type field contains the URI of requested Project creates a liking Relation between the user and project. | |||
|- | |||
| Example || curl --dump-header - -H "Content-Type:application/json" -X POST --data '{"user":"/api/v1/profile/2/" ,"liked_content_type":"/api/v1/projects/2/" }' http://127.0.0.1:8000/api/v1/liking/?username=vrinda\&api_key=b7c19215d088591e2dee07c2fb4df677ab1c9fbe | |||
|- | |||
| GET /api/v1/liking/ || Returns the list of all the liking relationship with their resource id and other liking resource. | |||
|- | |||
| GET /api/v1/liking/<id> || { | |||
"Liked": "undefined", | |||
"id": 2, | |||
"liked_content_type": { | |||
"Likes": 1, | |||
"comment": [ | |||
{ | |||
"entry": "undefined", | |||
"resource_uri": "/api/v1/comment/1/", | |||
"text": ":P", | |||
"user": "vrinda" | |||
} | |||
], | |||
"desc": "undefined", | |||
"history": "project undefined created by aregee forked by vrinda ", | |||
"id": 4, | |||
"resource_uri": "/api/v1/projects/4/", | |||
"screenshot": "/media/projects/wb3_1.png", | |||
"shared_date": "2013-09-20T19:09:43.084615", | |||
"src": "/media/projects/feed__1.py", | |||
"title": "undefined", | |||
"user": "vrinda" | |||
}, | |||
"resource_uri": "/api/v1/liking/2/", | |||
"shared_date": "2013-09-20T19:09:59.892135", | |||
"user": "vrinda" | |||
} | |||
|- | |||
| DELETE /api/v1/liking/<id>/ || Destroys the requested liked relation. | |||
|- | |||
|} | |||
==== Comment Resource ==== | |||
{| class="wikitable" | |||
|- | |||
! Description !! Resource | |||
|- | |||
| POST /api/v1/comment/ || This resource creates a new comment resource with the JSON data supplied to it.Returns 201 response for successfully added comment. | |||
|- | |||
| Example || curl --dump-header - -H "Content-Type:application/json" -X POST --data '{"user":"/api/v1/profile/1/","entry":"/api/v1/projects/2/" , "text":"Comment posted with REST" }' http://127.0.0.1:8000/api/v1/comment/?username=soeone\&api_key=som23h32gh2g3h3g2h3gh2213ftf32f | |||
|- | |||
| GET /api/v1/comment/ || List all the comments along with their related Project Resource. | |||
|- | |||
| GET /api/v1/comment/<id>/ || Filters the Comment resource by their respective ids. | |||
|- | |||
| PATCH /api/v1/comment/<id>/ || Updates the text field in the comment. | |||
|- | |||
| Example || curl --dump-header - -H "Content-Type:application/json" -X PATCH --data '{"text":"Comment POSTed with updated with PATCH" }' http://127.0.0.1:8000/api/v1/comment/1/?username=aregee\&api_key=ytg67asdf76asdf76fdsa767asdf67sadtg | |||
|- | |||
| DELETE /api/v1/comment/<id>/ || Making a delete request to the comment id , deletes the comment from the related resource or Project. | |||
|} | |||
| Line 355: | Line 413: | ||
* Top Level View : http:// | * Top Level View :curl --dump-header - -H "Content-Type: application/json" -X GET http://moksaya-rahulgaur.rhcloud.com/api/v1/profile/?username=spock\&api_key=d2fe32b15b0b395a5d0e0ea4b7eb1e5d6ea15de7 | ||
HTTP/1.1 200 OK | |||
Date: Sat, 21 Sep 2013 01:32:01 GMT | |||
Server: Apache/2.2.15 (Red Hat) | |||
Vary: Accept,Accept-Language,Cookie,Accept-Encoding | |||
X-Frame-Options: SAMEORIGIN | |||
Content-Language: en-us | |||
Cache-Control: no-cache | |||
Content-Type: application/json | |||
Transfer-Encoding: chunked | |||
{ | |||
"meta": { | "meta": { | ||
"limit": 20, | "limit": 20, | ||
"next": | "next": "/api/v1/profile/?username=spock&api_key=d2fe32b15b0b395a5d0e0ea4b7eb1e5d6ea15de7&limit=20&offset=20", | ||
"offset": 0, | "offset": 0, | ||
"previous": null, | "previous": null, | ||
"total_count": | "total_count": 26 | ||
}, | }, | ||
"objects": [ | "objects": [ | ||
{ | { | ||
"about_me": " | "about_me": "admin", | ||
" | "followers": [ | ||
" | "aregee" | ||
" | ], | ||
" | "following": [], | ||
], | "id": 1, | ||
" | "language": "en", | ||
"language": "en", | "location": "", | ||
"location": " | "mugshot": null, | ||
"mugshot": | "privacy": "registered", | ||
"privacy": "registered", | "projects": [], | ||
"resource_uri": "/api/v1/profile/1/", | |||
"user": "admin" | |||
}, | |||
{ | |||
"about_me": "Now I can update About_ME", | |||
"followers": [ | |||
"vrinda", | |||
"kirk", | |||
"ned", | |||
"titiksha", | |||
"robStark", | |||
"jarvis", | |||
"satyamyadav", | |||
"user101", | |||
"atif", | |||
"nikking1793", | |||
"tch", | |||
"amigo", | |||
"aregee__" | |||
], | |||
"following": [ | |||
"vrinda", | |||
"ned", | |||
"kirk", | |||
"tch", | |||
"admin", | |||
"titiksha", | |||
"jarvis", | |||
"monikagupta", | |||
"satyamyadav", | |||
"surajgillespie", | |||
"nikking1793", | |||
"amigo", | |||
"raju" | |||
], | |||
"id": 2, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [ | "projects": [ | ||
{ | { | ||
"Likes": | "Likes": 1, | ||
"comment": [ | "comment": [], | ||
"desc": "undefined", | |||
"history": "", | |||
"id": 1, | |||
"resource_uri": "/api/v1/projects/1/", | |||
"screenshot": "/media/projects/wb3.png", | |||
"shared_date": "2013-09-20T19:07:29.101309", | |||
"src": "/media/projects/feed_.py", | |||
"title": "undefined", | |||
"user": "aregee" | |||
}, | |||
" | |||
" | |||
"screenshot": "/media/projects/ | |||
"shared_date": "2013- | |||
"src": "/media/ | |||
"title": " | |||
}, | |||
{ | { | ||
"Likes": | "Likes": 0, | ||
"comment": [], | "comment": [], | ||
"desc": " | "desc": "undefined", | ||
" | "history": "", | ||
"screenshot": "/media/projects/ | "id": 2, | ||
"shared_date": "2013- | "resource_uri": "/api/v1/projects/2/", | ||
"src": "/media/ | "screenshot": "/media/projects/lin.jpg", | ||
"title": " | "shared_date": "2013-09-20T19:07:57.861892", | ||
}, | "src": "/media/projects/file_rem.py", | ||
"title": "undefined", | |||
"user": "aregee" | |||
}, | |||
{ | { | ||
"Likes": 0, | "Likes": 0, | ||
"comment": [], | "comment": [], | ||
"desc": " | "desc": "undefined", | ||
" | "history": "", | ||
"screenshot": "/media/projects/ | "id": 3, | ||
"shared_date": "2013- | "resource_uri": "/api/v1/projects/3/", | ||
"src": "/media/ | "screenshot": "/media/projects/beautiful_strings.png", | ||
"title": " | "shared_date": "2013-09-20T19:08:30.575741", | ||
"src": "/media/projects/file_rem_1.py", | |||
"title": "undefined", | |||
"user": "aregee" | |||
} | } | ||
], | ], | ||
" | "resource_uri": "/api/v1/profile/2/", | ||
" | "user": "aregee" | ||
}, | }, | ||
{ | { | ||
"about_me": " | "about_me": "Oh not it won't happen :0", | ||
" | "followers": [ | ||
" | "aregee" | ||
"aregee", | ], | ||
" | "following": [ | ||
], | "aregee", | ||
" | "kirk", | ||
"language": "en", | "jarvis" | ||
"location": " | ], | ||
"mugshot": null, | "id": 3, | ||
"privacy": "registered", | "language": "en", | ||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [ | "projects": [ | ||
{ | { | ||
"Likes": | "Likes": 1, | ||
"comment": [], | "comment": [ | ||
"desc": " | { | ||
" | "entry": "undefined", | ||
"screenshot": "/media/projects/ | "resource_uri": "/api/v1/comment/1/", | ||
"shared_date": "2013- | "text": ":P", | ||
"src": "/media/ | "user": "vrinda" | ||
"title": " | } | ||
}, | ], | ||
"desc": "undefined", | |||
"history": "project undefined created by aregee forked by vrinda ", | |||
"id": 4, | |||
"resource_uri": "/api/v1/projects/4/", | |||
"screenshot": "/media/projects/wb3_1.png", | |||
"shared_date": "2013-09-20T19:09:43.084615", | |||
"src": "/media/projects/feed__1.py", | |||
"title": "undefined", | |||
"user": "vrinda" | |||
}, | |||
{ | { | ||
"Likes": 0, | "Likes": 0, | ||
"comment": [], | "comment": [], | ||
"desc": " | "desc": "undefined", | ||
" | "history": "project undefined created by aregee forked by vrinda ", | ||
"screenshot": "/media/projects/ | "id": 5, | ||
"shared_date": "2013- | "resource_uri": "/api/v1/projects/5/", | ||
"src": "/media/ | "screenshot": "/media/projects/lin_1.jpg", | ||
"title": " | "shared_date": "2013-09-20T19:22:22.520212", | ||
"src": "/media/projects/file_rem_2.py", | |||
"title": "undefined", | |||
"user": "vrinda" | |||
} | } | ||
], | ], | ||
"user": " | "resource_uri": "/api/v1/profile/3/", | ||
" | "user": "vrinda" | ||
}, | }, | ||
{ | |||
"about_me": "I am SPOCK", | |||
"followers": [], | |||
"following": [], | |||
"id": 4, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/4/", | |||
"user": "spock" | |||
}, | |||
{ | |||
"about_me": "Howdy partner, this is kirk's Moksaya Profile", | |||
"followers": [ | |||
"aregee", | |||
"vrinda" | |||
], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 5, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/5/", | |||
"user": "kirk" | |||
}, | |||
{ | { | ||
"about_me": " | "about_me": "Howdy partner, this is ned's Moksaya Profile", | ||
" | "followers": [ | ||
" | "aregee" | ||
"aregee", | ], | ||
" | "following": [ | ||
], | "aregee" | ||
" | ], | ||
"language": "en", | "id": 6, | ||
"location": " | "language": "en", | ||
"mugshot": "/ | "location": "", | ||
"privacy": "registered", | "mugshot": null, | ||
"projects": [], | "privacy": "registered", | ||
"user": " | "projects": [], | ||
" | "resource_uri": "/api/v1/profile/6/", | ||
} | "user": "ned" | ||
}, | |||
{ | |||
"about_me": "sdasd", | |||
"followers": [ | |||
"aregee" | |||
], | |||
"following": [ | |||
"aregee" | |||
"aregee", | ], | ||
"id": 7, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/7/", | |||
"user": "tch" | |||
}, | |||
{ | |||
"about_me": "I am Titiksha", | |||
"followers": [ | |||
"aregee" | |||
], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 8, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/8/", | |||
"user": "titiksha" | |||
}, | |||
{ | |||
"about_me": "This is Rob Stark , King in the North ;)", | |||
"followers": [], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 9, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/9/", | |||
"user": "robStark" | |||
}, | |||
{ | |||
"about_me": "Howdy partner, this is mronetwo's Moksaya Profile", | |||
"followers": [], | |||
"following": [], | |||
"id": 10, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/10/", | |||
"user": "mronetwo" | |||
}, | |||
{ | |||
"about_me": "Howdy partner, this is monikagupta's Moksaya Profile", | |||
"followers": [ | |||
"aregee" | |||
], | |||
"following": [], | |||
"id": 11, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/11/", | |||
"user": "monikagupta" | |||
}, | |||
{ | |||
"about_me": "Howdy partner, this is jarvis's Moksaya Profile", | |||
"followers": [ | |||
"aregee", | |||
"vrinda" | |||
], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 12, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/12/", | |||
"user": "jarvis" | |||
}, | |||
{ | |||
"about_me": "Howdy partner, this is satyamyadav's Moksaya Profile", | |||
"followers": [ | |||
"aregee" | |||
], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 13, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/13/", | |||
"user": "satyamyadav" | |||
}, | |||
{ | |||
"about_me": "Hello , I am user1010 and I code :)", | |||
"followers": [], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 14, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/14/", | |||
"user": "user101" | |||
}, | |||
{ | |||
"about_me": "Howdy atif , this is your Moksaya Profile", | |||
"followers": [], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 15, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/15/", | |||
"user": "atif" | |||
}, | |||
{ | |||
"about_me": "Howdy surajgillespie , this is your Moksaya Profile", | |||
"followers": [ | |||
"aregee" | |||
], | |||
"following": [], | |||
"id": 16, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/16/", | |||
"user": "surajgillespie" | |||
}, | |||
{ | |||
"about_me": "Howdy partner, this is moksaya_user's Moksaya Profile", | |||
"followers": [], | |||
"following": [], | |||
"id": 17, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/17/", | |||
"user": "moksaya_user" | |||
}, | |||
{ | |||
"about_me": "Howdy nikking1793 , this is your Moksaya Profile", | |||
"followers": [ | |||
"aregee", | |||
"user102" | |||
], | |||
"following": [ | |||
"aregee" | |||
], | |||
"id": 18, | |||
"language": "en", | |||
"location": "", | |||
"mugshot": null, | |||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/18/", | |||
"user": "nikking1793" | |||
}, | |||
{ | { | ||
" | "about_me": "Howdy Ayushletsrock , this is your Moksaya Profile", | ||
" | "followers": [ | ||
" | "user102" | ||
" | ], | ||
" | "following": [], | ||
" | "id": 20, | ||
" | "language": "en", | ||
" | "location": "", | ||
}, | "mugshot": null, | ||
"privacy": "registered", | |||
"projects": [], | |||
"resource_uri": "/api/v1/profile/20/", | |||
"user": "Ayushletsrock" | |||
}, | |||
{ | { | ||
" | "about_me": "Howdy gonzalo , this is your Moksaya Profile", | ||
" | "followers": [], | ||
" | "following": [], | ||
" | "id": 21, | ||
" | "language": "en", | ||
" | "location": "", | ||
" | "mugshot": null, | ||
" | "privacy": "registered", | ||
"projects": [], | |||
"resource_uri": "/api/v1/profile/21/", | |||
"user": "gonzalo" | |||
} | } | ||
] | ] | ||
} | |||
* Related Resource Projects here can be accessed by http://127.0.0.1:8000/api/v1/projects/?format=json | * Related Resource Projects here can be accessed by http://127.0.0.1:8000/api/v1/projects/?format=json | ||