- suburb (A singular
Suburbs
Object) - suburb_id (ID of the user's suburb)
- attended (A list of
Events
object)
- suburb (A singular
Suburbs
Object) - suburb_id (ID of the user's suburb)
- events (A list of
Events
objects.)
- organisation (A singular
Organisation
object) - org_id (ID of the event's org)
- attendees (A list of
Users
object)
- users (A list of
Users
object) - orgs (A list of
Organisation
objects)
URL = http://host_url/user_login
Method = POST
Request format: JSON object with fields username
and password
. Both fields should be
strings.
Example: {username: "test", password: "test"}
Response format JSON object with the following fields:
-
status
. Will either be"success"
or"failure"
depending on if the credentials are correct -
postcode
: User's postcode -
suburb
: User's suburb -
type
: User's account type (student/mentor) -
username
: User's username -
password
: User's password -
range
: User's range
IF type
= "student"
high_school
: Student's High schoolyear_level
: Student's year level
IF type
= "mentor"
address
: Mentor's addressage
: Mentor's age
Example: {'postcode': 3053, 'status': 'success', 'suburb': 'Carlton', 'type': 'test', 'username': 'test', 'password': 'test', 'high_school': 'test', 'year_level': 12}
All other request methods (such as GET) will return a plaintext error message.
URL = http://host_url/org_login
Method = POST
Request and Response format same as Users. Refer to above.
URL = http://host_url/student_signup
Method = POST
Request format: JSON object with fields:
username
: Usernamepassword
: Passwordhighschool
: Which high school they were inyearlevel
: Which year level, must be digit(s)lat
: Latitude of the current location of the userlongitude
: Longitude of the current location of the userrange
: Range (in km) that the user is willing to volunteer from his Suburb
Example: {username: "admin", password="admin", highschool:"example_hs", yearlevel:10, lat:-36.926079, long:174.727066, range:10}
Response format: A success response will be: {status:"success"}
. Failure conditions:
- Empty username or empty password fields.
status
will be"failure"
anderror
will be"Empty fields"
- The username is already registered.
status
will be"failure"
anderror
will be"Duplicate username"
- An invalid longitude and latitude.
status
will be"failure"
anderror
will be"Invalid location"
Example:
-
{username: "admin", password="admin", highschool:"example_hs", yearlevel:10, lat:-36.926079, long:174.727066}
will result in{status: "success"}
-
{username: "", password="admin", highschool:"example_hs", yearlevel:10, lat:-36.926079, long:174.727066}
will result in{status: "failure" error:"Empty fields"}
-
{username: "admin", password="admin", highschool:"example_hs", yearlevel:10, lat:12345, long:67890abc}
will result in{status: "failure" error:"Invalid location"}
Make sure the longtitude and latitude is stored correctly in long
and lat
respsectively.
Mixing the 2 up will result in an incorrect suburb being assigned to the user.
URL = http://host_url/mentor_signup
Method = POST
Request format: JSON object with fields:
username
: Usernamepassword
: Passwordage
: Their age must be digit(s)address
: Their addresslat
: Latitude of the current location of the userlongitude
: Longitude of the current location of the userrange
: Range (in km) that the user is willing to volunteer from his Suburb
Example {username: "admin", password="admin", age:21, address:"10 abc St XYZ", lat:-36.926079, long:174.727066, range:10}
Response format Exact same as student signup. Same failure conditions, please refer to above.
Mentor signup and student signup works in very similar fashion, just different URLs.
URL = http://host_url/org_signup
Method = POST
Request format: JSON object with fields:
name
: Name of the businessusername
: Usernamepassword
: Passwordlat
: Latitude of the current location of the userlongitude
: Longitude of the current location of the user
Example {name: "businessA", username: "admin", password="admin", lat:-36.926079, long:174.727066, isEvent:False}
Response format Exact same as student/mentor signup. Same failure conditions, please refer to above.
Organisation signup and student signup works in very similar fashion, just different URLs.
URL = http://host_url/create_event
Method = POST
Request format: JSON object with fields:
username
: Username of selected Organisationpassword
: Password of selected Organisationevent_name
: Name of the eventevent_begin
: DateTime of when the event startsevent_end
: Optional DateTime of when the event endsaddress
: Address of the event as just a stringdescription
: Description of the event
Example {username: "admin", password="admin", event_name: "Test", event_begin: 2021-04-17 16:39:56.964868, event_end: 2021-04-17 16:39:56.964868, address: '24 Batman Rd', description: 'Test'}
Response format: A success response will be: {status:"success"}
. Failure conditions:
- If the organisation is not eligible to host an event.
status
will be"failure"
anderror
will be"Organisation is not eligible to create a new event this week"
- The username and/or password don't match.
status
will be"failure"
anderror
will be"Issue with user information"
URL http://host_url/update_user
Method = POST
Request format: JSON object with fields:
username
password
(Username and password must both be non-empty)address
highschool
yearlevel
Must be digitsstartdate
This must be indd/mm/yy hh:mm:ss
formatenddate
This must be indd/mm/yy hh:mm:ss
formatsuburb
This is the name of the suburbpostcode
This is the suburb postcode
Example: {username: "test", password:"test", address:"test st", highschool:"test", yearlevel:10, startdate:"01/01/21 10:11:12", enddate:"01/02/21 13:14:15", suburb: "Carlton", postcode:3053}
Response format: JSON object with fields:
status
Can either be success or failure. Failure will indicate something is wrongerror
Will only appear if status is failure.
Example {'error': "Suburb doesn't exist", 'status': 'failure'}
URL http://host_url/search
Method = POST
Request format: JSON object with fields:
address
range
Must be above 0 (in km)
Example: {address: "Melbourne", range: "30"}
Response format: JSON object with fields:
status
Either success or failureerror
Only when status is failure, always for when address is not validevents
List of all the events that fit the search
URL http://host_url/set_events
Method = POST
Request format: JSON object with fields:
token
using the correct token to be able to set up the events
Response format: JSON object with fields:
status
Either success or failureerror
Only when status is failure, always for when token isn't valid
URL http://host_url/calendar
Method = POST
Request format: JSON object with username
field. username
would be the username of
the currently logged in user.
Example: {username: "test"}
Response format: url
field which contains a URL the user needs to click. URL is a google login
URL that basically gives my Google App permission to access user's google calendar via Calendar API.
Front end needs to extract that url, and pop it in a new window or something. Once the user has
logged in with the Google URL, their latest event will be automatically added to their calendar.
Example {url: "some_long_ass_url"}
URL http://host_url/get_event
Method = POST
Request format : JSON Object with event_id
field
Example: {event_id: 1}
Response format JSON object with the following fields:
status
. Will either be"success"
or"failure"
depending on if the event_id is correct
IF it is success
event_id
ID of the eventorg_id
ID of the organisationevent_name
Name of the eventbegin
DateTime of when the event beginsend
DateTime of when the event ends (can beNone
)address
String value of the address of the eventdescription
Description of the eventcompleted
Boolean on whether the event has been completed or not
Example {event_id: 1, org_id: 1, event_name: "Test", begin: :"01/01/21 10:11:12", end: "01/02/21 13:14:15", address: "24 Batman Rd", description: "Test", completed: False}
Simply put the following script (which will generate paypal buttons) into the website
src="https://www.paypal.com/sdk/js?client-id=Ab-TmVOOF38HXqyvqZN8T5pvj_mgN5WYSW2RE7kbwLoFFYqVB18CF7bMrWtZAjp-8IzZnYUsx2VELDBf"> // Required. Replace YOUR_CLIENT_ID with your sandbox client ID.
</script>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: '100'
}
}]
});
},
onApprove: function(data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
// This function shows a transaction success message to your buyer.
alert('Transaction completed by ' + details.payer.name.given_name);
});
}
}).render('body');
</script>
Currently paypal would only work within a "sandbox environment". Meaning, transactions are tot real and only dummy accounts can be used. Details of the dummy account (used for demo purposes)
- Email: [email protected]
- Password: o0zy%Zu9