/NGORestAPI

Simnple NGO REST API for group project

Primary LanguageJava

NGORestAPI

Simnple NGO REST API for group project

##USER

getUsers() GET “http://localhost:8080/api/user/getAllUsers”

registerUser() POST “http://localhost:8080/api/user/register”

{
    "id": 2,
    "firstName": "Derek",
    "lastName": "Brown",
    "email": "derek@gmail.com",
    "password": "asdf",
    "role": "REGULAR"
}

id is autogenerated. Not needed in registration. email must be unique.

login() POST “http://localhost:8080/api/user/login”

{
    "email": "derek@gmail.com",
    "password": "asdf"
}

include those as body for field. Can go over how this works on back end for full understanding.

updateUser() PUT “http://localhost:8080/api/user/updateUser/{id}”

{
    "firstName": "Derek",
    "lastName": "Brown",
    "email": "derek@gmail.com",
    "password": "asdf",
    "role": "ADMIN"
}

Don’t include id in body. Will pull id from pathvariable and set it into the body for update. Will explain later.

deleteUser() DELETE “http://localhost:8080/api/user/deleteUser/{id}”

##EVENT

getAllEvents() GET “http://localhost:8080/api/event/getAllEvents”

registerEvent() POST “http://localhost:8080/api/event/register”

{
    "title": "Wag the Dog",
    "description": "Charity drive benefiting our local ASPCA organization. All donations will help in mainintaining shelters and providing comprehensive care to animals in need."
}

id autogenerated. Not needed in registration. Title must be unique.

updateEvent() PUT “http://localhost:8080/api/event/updateEvent/{id}”

 {
        "id": 3,
        "title": "Wag the Dog",
        "description": "Update Update Update."
 }

Don’t need to include in update. Id will be inserted from pathvariables.

##Donation

getAllDonations() GET “http://localhost:8080/api/donation/getAllDonations()”

registerDonation() POST “http://localhost:8080/api/donation/register” id autogenerated, no need to include in registration. No unique fields besides ID

Not needed, but created while I was testing. May be able to use later if reason deleteDonation() DELETE “http://localhost:8080/api/donation/delete/{id}”