OpenSalve API API Reference
OpenSalve API https://github.com/subins2000/OpenSalve
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
Paths
GET /api/
Return API info
POST /api/
Return API info
GET /api/accounts/login
Login user
POST /api/accounts/register
Register a user
undefined
Request Example
{
"username": "string",
"password": "string",
"email": "string (email)",
"name": "string"
}
Response Example (201 Created)
{
"username": "string",
"password": "string",
"email": "string (email)",
"name": "string"
}
GET /api/accounts/u/{username}
Get info of user
(no description)
PUT /api/accounts/u/{username}
Info of user
(no description)
PATCH /api/accounts/u/{username}
Update info of user
(no description)
GET /api/camps/
Get all camps
Number of results to return per page.
The initial index from which to return the results.
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"
}
]
}
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"
}
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"
}
GET /api/camps/c/{id}
Get info about a camp
(no description)
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"
}
GET /api/camps/c/{id}/inhabitants
Get all inhabitants in camp
Number of results to return per page.
The initial index from which to return the results.
(no description)
Response Example (200 OK)
{
"count": "integer",
"next": "string (uri)",
"previous": "string (uri)",
"results": [
{
"id": "integer",
"camp": "string",
"name": "string",
"location": "string",
"blood_group": "string"
}
]
}
POST /api/camps/c/{id}/inhabitants
Add a inhabitant to camp
undefined
(no description)
Request Example
{
"name": "string",
"location": "string",
"blood_group": "string"
}
Response Example (201 Created)
{
"id": "integer",
"camp": "string",
"name": "string",
"location": "string",
"blood_group": "string"
}
GET /api/collectioncentres/
Get all collection centres
Number of results to return per page.
The initial index from which to return the results.
Response Example (200 OK)
{
"count": "integer",
"next": "string (uri)",
"previous": "string (uri)",
"results": [
{
"id": "integer",
"lat": "string",
"lng": "string",
"location": "string"
}
]
}
POST /api/collectioncentres/
Add a collection centre
undefined
Request Example
{
"lat": "string",
"lng": "string",
"location": "string"
}
Response Example (201 Created)
{
"id": "integer",
"lat": "string",
"lng": "string",
"location": "string"
}
GET /api/collectioncentres/c/{id}
Get info about a collection centre
(no description)
Response Example (200 OK)
{
"id": "integer",
"lat": "string",
"lng": "string",
"location": "string"
}
GET /api/collectioncentres/c/{id}/stock
Get information about stock in collection centre
Number of results to return per page.
The initial index from which to return the results.
(no description)
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"
}
]
}
POST /api/collectioncentres/c/{id}/stock
Add information about stock item needed
undefined
(no description)
Request Example
{
"item": "string",
"quantity": "integer",
"need_quantity": "integer",
"unit": "string",
"centre": "integer"
}
Response Example (201 Created)
{
"id": "integer",
"item": "string",
"quantity": "integer",
"need_quantity": "integer",
"unit": "string",
"centre": "integer"
}
GET /api/help/
Get all requests
Number of results to return per page.
The initial index from which to return the results.
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"
}
]
}
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"
}
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"
}
GET /api/help/r/{id}
Get info about a help request
(no description)
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"
}
PUT /api/help/r/{id}
Get info about a help request
undefined
(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"
}
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"
}
PATCH /api/help/r/{id}
Get info about a help request
undefined
(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"
}
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"
}
GET /api/help/r/{id}/comments
Get all comments of request
Number of results to return per page.
The initial index from which to return the results.
Unique ID of comment
Response Example (200 OK)
{
"count": "integer",
"next": "string (uri)",
"previous": "string (uri)",
"results": [
{
"id": "integer",
"user": "string",
"comment": "string",
"created_at": "string (date-time)"
}
]
}
POST /api/help/r/{id}/comments
Add a comment to request
undefined
Unique ID of comment
Request Example
{
"comment": "string"
}
Response Example (201 Created)
{
"id": "integer",
"comment": "string",
"created_at": "string (date-time)"
}
GET /api/help/r/{id}/status
Get status of request
(no description)
Response Example (200 OK)
{
"status": "string"
}
PUT /api/help/r/{id}/status
Get/Set status of request
undefined
(no description)
Request Example
{
"status": "string"
}
Response Example (200 OK)
{
"status": "string"
}
PATCH /api/help/r/{id}/status
Set status of request
undefined
(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)"
}