OpenSalve API API Reference

API Endpoint
http://127.0.0.1:8000/
Request Content-Types: application/json
Response Content-Types: application/json
Schemes: http
Version: v0.1

Authentication

basic

type
basic

Paths

api

GET /api/

Return API info

200 OK
api

POST /api/

Return API info

201 Created
api

GET /api/accounts/login

Login user

200 OK
api

POST /api/accounts/register

Register a user

undefined

Request Example
{
  "username": "string",
  "password": "string",
  "email": "string (email)",
  "name": "string"
}
201 Created
Response Example (201 Created)
{
  "username": "string",
  "password": "string",
  "email": "string (email)",
  "name": "string"
}
api

GET /api/accounts/u/{username}

Get info of user

username: string
in path

(no description)

200 OK
api

PUT /api/accounts/u/{username}

Info of user

username: string
in path

(no description)

200 OK
api

PATCH /api/accounts/u/{username}

Update info of user

username: string
in path

(no description)

200 OK
api

GET /api/camps/

Get all camps

limit: integer
in query

Number of results to return per page.

offset: integer
in query

The initial index from which to return the results.

200 OK
type
object
Response Example (200 OK)
{
  "count": "integer",
  "next": "string (uri)",
  "previous": "string (uri)",
  "results": [
    {
      "id": "integer",
      "lat": "string",
      "lng": "string",
      "location": "string",
      "incharge": "string",
      "phone": "string",
      "photo": "string (uri)",
      "capacity": "integer",
      "number_of_people": "integer"
    }
  ]
}
api

POST /api/camps/

Add a camp

undefined

Request Example
{
  "lat": "string",
  "lng": "string",
  "location": "string",
  "incharge": "string",
  "phone": "string",
  "capacity": "integer",
  "number_of_people": "integer"
}
201 Created
Response Example (201 Created)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "incharge": "string",
  "phone": "string",
  "photo": "string (uri)",
  "capacity": "integer",
  "number_of_people": "integer"
}
api

GET /api/camps/c/{id}

Get info about a camp

id: string
in path

(no description)

200 OK
Response Example (200 OK)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "incharge": "string",
  "phone": "string",
  "photo": "string (uri)",
  "capacity": "integer",
  "number_of_people": "integer"
}
api

GET /api/camps/c/{id}/inhabitants

Get all inhabitants in camp

limit: integer
in query

Number of results to return per page.

offset: integer
in query

The initial index from which to return the results.

id: string
in path

(no description)

200 OK
type
object
Response Example (200 OK)
{
  "count": "integer",
  "next": "string (uri)",
  "previous": "string (uri)",
  "results": [
    {
      "id": "integer",
      "camp": "string",
      "name": "string",
      "location": "string",
      "blood_group": "string"
    }
  ]
}
api

POST /api/camps/c/{id}/inhabitants

Add a inhabitant to camp

undefined

id: string
in path

(no description)

Request Example
{
  "name": "string",
  "location": "string",
  "blood_group": "string"
}
201 Created
Response Example (201 Created)
{
  "id": "integer",
  "camp": "string",
  "name": "string",
  "location": "string",
  "blood_group": "string"
}
api

GET /api/collectioncentres/

Get all collection centres

limit: integer
in query

Number of results to return per page.

offset: integer
in query

The initial index from which to return the results.

200 OK
type
object
Response Example (200 OK)
{
  "count": "integer",
  "next": "string (uri)",
  "previous": "string (uri)",
  "results": [
    {
      "id": "integer",
      "lat": "string",
      "lng": "string",
      "location": "string"
    }
  ]
}
api

POST /api/collectioncentres/

Add a collection centre

undefined

Request Example
{
  "lat": "string",
  "lng": "string",
  "location": "string"
}
201 Created
Response Example (201 Created)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string"
}
api

GET /api/collectioncentres/c/{id}

Get info about a collection centre

id: string
in path

(no description)

Response Example (200 OK)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string"
}
api

GET /api/collectioncentres/c/{id}/stock

Get information about stock in collection centre

limit: integer
in query

Number of results to return per page.

offset: integer
in query

The initial index from which to return the results.

id: string
in path

(no description)

200 OK
type
object
Response Example (200 OK)
{
  "count": "integer",
  "next": "string (uri)",
  "previous": "string (uri)",
  "results": [
    {
      "id": "integer",
      "item": "string",
      "quantity": "integer",
      "need_quantity": "integer",
      "unit": "string",
      "centre": "integer"
    }
  ]
}
api

POST /api/collectioncentres/c/{id}/stock

Add information about stock item needed

id: string
in path

(no description)

Request Example
{
  "item": "string",
  "quantity": "integer",
  "need_quantity": "integer",
  "unit": "string",
  "centre": "integer"
}
201 Created
Response Example (201 Created)
{
  "id": "integer",
  "item": "string",
  "quantity": "integer",
  "need_quantity": "integer",
  "unit": "string",
  "centre": "integer"
}
api

GET /api/help/

Get all requests

limit: integer
in query

Number of results to return per page.

offset: integer
in query

The initial index from which to return the results.

200 OK
type
object
Response Example (200 OK)
{
  "count": "integer",
  "next": "string (uri)",
  "previous": "string (uri)",
  "results": [
    {
      "id": "integer",
      "lat": "string",
      "lng": "string",
      "location": "string",
      "created_at": "string (date-time)",
      "name": "string",
      "phone": "string",
      "request_for_others": "boolean",
      "number_of_people_with_you": "integer",
      "source": "string",
      "need_food": "boolean",
      "need_medicine": "boolean",
      "need_rescue": "boolean",
      "need_water": "boolean",
      "status": "string"
    }
  ]
}
api

POST /api/help/

Add a request

undefined

Request Example
{
  "lat": "string",
  "lng": "string",
  "location": "string",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}
201 Created
Response Example (201 Created)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "created_at": "string (date-time)",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}
api

GET /api/help/r/{id}

Get info about a help request

id: string
in path

(no description)

200 OK
Response Example (200 OK)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "created_at": "string (date-time)",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}
api

PUT /api/help/r/{id}

Get info about a help request

undefined

id: string
in path

(no description)

Request Example
{
  "lat": "string",
  "lng": "string",
  "location": "string",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}
200 OK
Response Example (200 OK)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "created_at": "string (date-time)",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}
api

PATCH /api/help/r/{id}

Get info about a help request

undefined

id: string
in path

(no description)

Request Example
{
  "lat": "string",
  "lng": "string",
  "location": "string",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}
200 OK
Response Example (200 OK)
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "created_at": "string (date-time)",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}
api

GET /api/help/r/{id}/comments

Get all comments of request

limit: integer
in query

Number of results to return per page.

offset: integer
in query

The initial index from which to return the results.

id: integer
in path

Unique ID of comment

200 OK
type
object
Response Example (200 OK)
{
  "count": "integer",
  "next": "string (uri)",
  "previous": "string (uri)",
  "results": [
    {
      "id": "integer",
      "user": "string",
      "comment": "string",
      "created_at": "string (date-time)"
    }
  ]
}
api

POST /api/help/r/{id}/comments

Add a comment to request

id: integer
in path

Unique ID of comment

Request Example
{
  "comment": "string"
}
201 Created
Response Example (201 Created)
{
  "id": "integer",
  "comment": "string",
  "created_at": "string (date-time)"
}
api

GET /api/help/r/{id}/status

Get status of request

id: string
in path

(no description)

Response Example (200 OK)
{
  "status": "string"
}
api

PUT /api/help/r/{id}/status

Get/Set status of request

undefined

id: string
in path

(no description)

Request Example
{
  "status": "string"
}
Response Example (200 OK)
{
  "status": "string"
}
api

PATCH /api/help/r/{id}/status

Set status of request

undefined

id: string
in path

(no description)

Request Example
{
  "status": "string"
}
Response Example (200 OK)
{
  "status": "string"
}

Schema Definitions

User: object

username: string (1 to 150 chars)

Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.

password: string (1 to 128 chars)
email: string (email) (1 to 100 chars)
name: string (1 to 60 chars)
Example
{
  "username": "string",
  "password": "string",
  "email": "string (email)",
  "name": "string"
}

Camps: object

id: integer

Unique ID of the camp

lat: string (1 to 20 chars)

Latitude

lng: string (1 to 20 chars)

Longitude

location: string (1 to 60 chars)

Location name

incharge: string (1 to 40 chars)

Camp incharge

phone: string (1 to 15 chars)

Camp phone number

photo: string (uri)
capacity: integer

The max capacity of the camp

number_of_people: integer

The number of people currently in the camp

Example
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "incharge": "string",
  "phone": "string",
  "photo": "string (uri)",
  "capacity": "integer",
  "number_of_people": "integer"
}

CampInhabitants: object

id: integer
camp: string
name: string (1 to 100 chars)

Name of person

location: string (1 to 100 chars)

Original place of person

blood_group: string (1 to 5 chars)

Blood group of person

Example
{
  "id": "integer",
  "camp": "string",
  "name": "string",
  "location": "string",
  "blood_group": "string"
}

CollectionCentre: object

id: integer

Unique ID of the collection centre

lat: string (1 to 20 chars)

Latitude

lng: string (1 to 20 chars)

Longitude

location: string (1 to 200 chars)

Location name

Example
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string"
}

CollectionCentreStock: object

id: integer

Unique ID of the stock

item: string (1 to 30 chars)

Stock item

quantity: integer

Quantity in stock

need_quantity: integer

Quantity required

unit: string (1 to 10 chars)

Unit of quantity

centre: integer
Example
{
  "id": "integer",
  "item": "string",
  "quantity": "integer",
  "need_quantity": "integer",
  "unit": "string",
  "centre": "integer"
}

Requests: object

id: integer

Unique ID of request

lat: string (up to 20 chars)

Latitude

lng: string (up to 20 chars)

Longitude

location: string (up to 60 chars)

Location name

created_at: string (date-time)
name: string (up to 50 chars)

Name of requestee

phone: string (1 to 20 chars)

Phone of requestee

request_for_others: boolean

Whether this request is not made for yourself

number_of_people_with_you: integer

The number of people stranded with you

source: string (up to 40 chars)

Where this request call was obtained from

need_food: boolean
need_medicine: boolean
need_rescue: boolean
need_water: boolean
status: string (up to 15 chars)

Status of request

Example
{
  "id": "integer",
  "lat": "string",
  "lng": "string",
  "location": "string",
  "created_at": "string (date-time)",
  "name": "string",
  "phone": "string",
  "request_for_others": "boolean",
  "number_of_people_with_you": "integer",
  "source": "string",
  "need_food": "boolean",
  "need_medicine": "boolean",
  "need_rescue": "boolean",
  "need_water": "boolean",
  "status": "string"
}

RequestCommentsRead: object

id: integer

Unique ID of comment

user: string
comment: string (1 to 1000 chars)

Comment text

created_at: string (date-time)
Example
{
  "id": "integer",
  "user": "string",
  "comment": "string",
  "created_at": "string (date-time)"
}

RequestCommentsWrite: object

id: integer

Unique ID of comment

comment: string (1 to 1000 chars)

Comment text

created_at: string (date-time)
Example
{
  "id": "integer",
  "comment": "string",
  "created_at": "string (date-time)"
}

RequestsStatus: object

status: string (up to 15 chars)

Status of request

Example
{
  "status": "string"
}