Skip to content
Ajith Hussain Subayar edited this page Aug 19, 2018 · 2 revisions

Enums

districts = (
    ('alp','Alappuzha - ആലപ്പുഴ'),
    ('ekm','Ernakulam - എറണാകുളം'),
    ('idk','Idukki - ഇടുക്കി'),
    ('knr','Kannur - കണ്ണൂർ'),
    ('ksr','Kasaragod - കാസർഗോഡ്'),
    ('kol','Kollam - കൊല്ലം'),
    ('ktm','Kottayam - കോട്ടയം'),
    ('koz','Kozhikode - കോഴിക്കോട്'),
    ('mpm','Malappuram - മലപ്പുറം'),
    ('pkd','Palakkad - പാലക്കാട്'),
    ('ptm','Pathanamthitta - പത്തനംതിട്ട'),
    ('tvm','Thiruvananthapuram - തിരുവനന്തപുരം'),
    ('tcr','Thrissur - തൃശ്ശൂർ'),
    ('wnd','Wayanad - വയനാട്'),
)
gender =(
    (0,'Male'),
    (1,'Female'),
    (2,'Others')
)

Login

  • Path: POST /api/1/rest-auth/login/
  • Params: username, password
  • Response format:
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNTM2MzY0MzQ5LCJlbWFpbCI6IiJ9.pSKf7-cuS18OqpmzH-GmcFeMs-46Rva6PjlsjFPUDE4",
    "user": {
        "pk": 1,
        "username": "admin",
        "email": "",
        "first_name": "",
        "last_name": ""
    }
}

Note: Subsequent authenticated requests are expected to have an Authorization header with JWT <token-string> as value.

Camp List

  • Path: GET /api/1/camplist/?district=<district-code>
  • Params: district (not sure what the codes are yet. alp works for Alappuzha. taken from the website filtering)
  • Response format:
[
    {
        "id": 1,
        "name": "Camp A",
        "district": "alp"
    }
]

Camps

  • Path: GET /api/1/camps/
  • Params: ?
  • Response format:
[
    {
        "id": 1,
        "name": "Camp A",
        "location": "Camp address",
        "district": "alp",
        "taluk": "taluk",
        "village": "village",
        "contacts": "3000000000",
        "map_link": "map-link",
        "latlng": "",
        "total_people": null,
        "total_males": null,
        "total_females": null,
        "total_infants": null,
        "food_req": "300",
        "clothing_req": "100",
        "sanitary_req": "300",
        "medical_req": "500",
        "other_req": "",
        "data_entry_user": 1
    }
]

Persons

  • Path: POST /api/1/persons/
  • Request body:
[
	{
		"name": "Person A",
		"phone": "Phone A",
		"gender": 0,
		"address": "Address of Person A",
		"district": "alp",
		"age": 44,
		"notes": "I am person A. These are my details",
		"camped_at": 1
	}
]
  • Response format:
{
    "status": "success",
    "message": "Person(s) added"
}