Merging changes to membership and institution docs.

This commit is contained in:
misund committed 2013-06-26 23:25:42 +02:00
commit cfc737e002
8 files changed
+201 -3

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ Contents:
member
group
membership
institution
Indices and tables
==================
+55
View File
@@ -0,0 +1,55 @@
Institution
======
GET /institution/
------------
.. http:get:: /institution/
Returns info about all institutions.
**Example request**:
.. sourcecode:: http
GET /institution/?format=json HTTP/1.1
:query offset: offset number. default is 0
:query limit: limit number. default is 20
:statuscode 200: Everything is gonna be alright.
:statuscode 403: User does not have necessary permissions.
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
"meta" : {
"limit" : 20,
"next" : null,
"offset" : 0,
"previous" : null,
"total_count" : 2
},
"objects" : [
{
"created": "2013-06-26T12:15:52.889701",
"id": 1,
"name": "Universitetet i Oslo",
"resource_uri": "/api/v1/institution/1/",
"short_name": "UiO",
"updated": "2013-06-26T12:15:52.889785"
},
{
"created": "2013-06-26T12:16:07.840886",
"id": 2,
"name": "Høgskolen i Oslo og Akershus",
"resource_uri": "/api/v1/institution/2/",
"short_name": "HiOA",
"updated": "2013-06-26T12:29:38.488712"
}
]
}
+102
View File
@@ -0,0 +1,102 @@
Membership
==========
GET /membership/
----------------
.. http:get:: /membership/
Returns info about all memberships.
**Example request**:
.. sourcecode:: http
GET /membership/?format=json HTTP/1.1
:query filter: one of ``valid``, ``can_vote``
:query offset: offset number. default is 0
:query limit: limit number. default is 20
:statuscode 200: Thumbs up!
:statuscode 403: Ur not authorized – don't cheat!
**Example response**:
.. sourcecode:: http
{
"meta" : {
"limit" : 20,
"next" : null,
"offset" : 0,
"previous" : null,
"total_count" : 1
},
"objects" : {
"created" : "2012-08-23T01:30:14",
"end_date" : "2013-08-01T00:00:00",
"id" : 1,
"member" : 1,
"membership_type" : 1,
"payment" : 86,
"start_date" : "2012-08-23T01:30:14",
"updated" : "2013-08-01T00:00:00",
}
}
GET /membership/(int)/
----------------------
.. http:get:: /membership/(int:membership_id)/
Returns info about membership (`membership_id`).
**Example request**:
.. sourcecode:: http
GET /membership/13371337/?format=json HTTP/1.1
Content-Type: application/json
:statuscode 200: Thumbs up!
:statuscode 403: You'll need to get authorized first, buddy.
:statuscode 404: This is not the membership you're looking for.
**Example response**:
.. sourcecode:: http
{
"membership" : {
"created" : "2012-08-23T01:30:14",
"end_date" : "2013-08-01T00:00:00",
"id" : 1,
"member" : 1,
"membership_type" : 1,
"payment" : 86,
"start_date" : "2012-08-23T01:30:14",
"updated" : "2013-08-01T00:00:00",
}
}
POST /membership/
-----------------
.. http:post:: /membership/
Creates a new membership with data given in body (json).
**Example request**:
.. sourcecode:: http
POST /membership/ HTTP/1.1
Body:
{
"member": 1337,
"membership_type": 1,
"payment": 16811,
}
:statuscode 201: You just created a brand new membership!
:statuscode 403: Don't fake it – get authorized!
:statuscode 500: You messed up and made a pile of poo. Check body, make sure values are correct.