This repository has been archived by the owner on Nov 8, 2018. It is now read-only.
forked from peacecorps/app-web-server
-
Notifications
You must be signed in to change notification settings - Fork 51
Home
Erika Tan edited this page Jan 13, 2017
·
3 revisions
#MACC API Documentation
This documentation is for the API that MACC uses to communicate with other mobile applications.
###URLs
- URL to store users of MACC -/api/users
- URL to store users of Malaria app -/api/malari_users
- URL to store infoHub posts related to Malaria -/api/malaria_posts
- URL to store PCSA posts by categories
URL to store MACC users - /api/users
Properties and Definitions:
- url: stores the URL representing the profile of the user
- username: String field to store username
- email: email field to store email ID of the user
- id: integer field, auto incremented
Methods:
POST
{
"url": {
"type": "field",
"required": false,
"read_only": true
},
"username": {
"type": "string",
"required": true,
"read_only": false,
"label": "username",
"help_text": "Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters",
"max_length": 30
},
"email": {
"type": "email",
"required": false,
"read_only": false,
"label": "email address",
"max_length": 75
},
"id": {
"type": "integer",
"required": false,
"read_only": true,
"label": "ID"
}
}
GET - (example)
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"url": "http://localhost:8001/api/users/2/",
"username": "qwer",
"email": "[email protected]",
"id": 2
},
{
"url": "http://localhost:8001/api/users/1/",
"username": "admin",
"email": "[email protected]",
"id": 1
}
]
}
URL to store users of Malaria app - /api/malari_users
Properties and Definitions:
- name: String field, Name of the user
- email: Email field, email ID of the user
- age: Integer field, age of the user
- medicineType: String field, medicine name for reminders
- id: Integer field, auto increment
Methods:
GET - (example)
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"name": "Name1",
"email": "[email protected]",
"age": 50,
"medicineType": "med1",
"id": 1
},
{
"name": "Name2",
"email": "[email protected]",
"age": 51,
"medicineType": "med2",
"id": 2
}
]
}
POST -
{
"name": {
"type": "string",
"required": true,
"read_only": false,
"label": "name",
"max_length": 200
},
"email": {
"type": "email",
"required": true,
"read_only": false,
"label": "email",
"max_length": 254
},
"age": {
"type": "integer",
"required": true,
"read_only": false,
"label": "age"
},
"medicineType": {
"type": "string",
"required": true,
"read_only": false,
"label": "medicineType",
"max_length": 100
},
"id": {
"type": "integer",
"required": false,
"read_only": true,
"label": "ID"
}
}
URL to store infoHub posts related to Malaria - /api/malaria_posts
Properties and Definitions:
- owner: Integer field, userid of the MACC user
- title_post: String field, Title for the post
- description_post: String field, description for the post
- created: DateTime field, time when post was created
- updated: DateTime field, time when post was published
- id: Integer field, auto increment
Methods:
GET - (example)
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"owner": 2,
"title_post": "Test 1",
"description_post": "This is test for malaria posts",
"created": "2016-08-12T13:36:52.213Z",
"updated": "2016-08-12T13:36:52.213Z",
"id": 1
}
]
}
URL to store infoHub posts related to PCSA - /api/pcsa_posts
Properties and Definitions:
- owner: Integer field, userid of the MACC user
- title: String field, Title for the post
- description: String field, description for the post
- created: DateTime field, time when post was created
- id: Integer field, auto increment
Methods:
GET - (example)
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"owner": 2,
"title": "Test 1 ",
"description": "This is the first test post for PCSA API testing.",
"created": "2016-08-12T15:52:22.379Z",
"id": 1
},
{
"owner": 2,
"title": "Test 2",
"description": "This is the second test for API testing on PCSA.",
"created": "2016-08-12T15:54:02.635Z",
"id": 2
}
]
}
Authentication for the API - The API is authenticated by using the correct username and password.