-
Notifications
You must be signed in to change notification settings - Fork 0
RESTful Endpoints
GET Methods
Users
/users - returns an array of all users currently within the system. Will most likely be access restricted in the final product.
/users/{ID} – retrieves the account user with this specific ID.
/users/{firstName}/{lastName} – retrieves users with this first and last name.
/users/email/{email} – retrieves users with this email address.
/addresses – returns an array of all addresses within the system. Again, should be access restricted. /addresses/{ID} – returns the address with the given ID.
Replacing the word ‘users’ in these URLs with either ‘adopters’, ‘owners’, or ‘managers’ will perform the same function, but only return the given type. As an example /adopters will return all adopters within the system. /owners/{firstName}/{lastName} could be useful for searching for a specific owner.
Pets
/pets - returns an array of all pets currently within the system. /pets/{ID} - returns the pet with the given ID.
/petApplicants/{petID} – returns a list of applicants for the given pet.
/petProfiles – returns all pet profiles in the system. /petProfiles/{ID} – returns the pet profile with the given ID.
/shelters – returns all shelters within the system. /shelters/{ID} – returns the shelter with the given ID.
/adoptPosts – returns all adoption postings within the system. /adoptPosts/{ID} – returns the adoption posting with the given ID.
POST Methods
Users
/adopters/{name}/{email}/{password}/{ID} – creates a new adopter with the given name, email, password, and ID, assuming all of these follow the common convention (such as full name, email with an ‘@’, etc.). Returns the created adopter (DTO).
/adopters/{name}/{email}/{password}/{ID}/{phone} – creates a new adopter as per the above method, though this time including a valid phone number (10 or 11 digits). Returns the created adopter (DTO).
/owners/{name}/{email}/{password}/{ID} – creates a new owner with the given name, email, password, and ID, assuming all of these follow the common convention (such as full name, email with an ‘@’, etc.). Returns the created owner (DTO).
/owners/{name}/{email}/{password}/{ID}/{phone} – creates a new owner as per the above method, though this time including a valid phone number (10 or 11 digits). Returns the created owner (DTO).
/managers/{name}/{email}/{password}/{ID} – creates a new manager with the given name, email, password, and ID, assuming all of these follow the common convention (such as full name, email with an ‘@’, etc.). Returns the created manager (DTO).
/managers/{name}/{email}/{password}/{ID}/{phone} – creates a new manager as per the above method, though this time including a valid phone number (10 or 11 digits). Returns the created manager (DTO).
/delete/user/{ID} – deletes the user with the given ID.
/addresses/{ID}/{streetNum}/{street}/{city}/{province}/{postal} – creates a new address with the given ID, street number, street name, city, province, and postal code. The inputs will be validated to ensure that, for example, street numbers only contain numbers and streets/cities/provinces only contain letters. Returns the created address (DTO).
Pets
/shelterPet/{ID}/{profileID}/{shelterID}/{postingID} – creates a new pet that is owned by the given shelter, with an adoptionPosting and description given via ID of the respective objects. If no such adoption posting ID or shelter ID exists yet, one will be created and assigned to the pet. Returns the created pet (DTO).
/ownerPet/{ID}/{profileID}/{ownerID}/{postingID} – creates a new pet that is owned by the given owner, with an adoption posting and description given via ID of the respective objects. If no such adoption posting ID exists yet, one will be created and assigned to the pet. Returns the created pet (DTO).
/addApplicant/{postID}/{adopterID} – adds an applicant with the given ID to the given adoption posting.
/delete/pet/{ID} – deletes the pet with the given ID.
/profile/{ID}/{name}/{type}/{description}/{breed}/{photoURL}/{apartment}/{kidsOK}/{petsOK}/{highEnergy}/{healthConcerns} – creates a new pet profile with the given attributes of the pet. That is: the name, the type of animal they are, a brief description of the pet, the specific breed, a URL to a photo, whether the pet is alright in apartments, whether they can handle kids, whether they can handle other pets, whether they have high energy, and a brief summary of major health concerns. Of course, all of these undergoes checks to make sure they are not being filled with impossible answers. Returns the created pet profile (DTO).
/profile/{ID}/{name}/{type}/{description}/{breed}/{photoURL}/{apartment}/{healthConcerns} – this method simply calls the more specific URL above, though the appropriate (unspecified) fields are set to null.
/profile/{ID}/{name}/{type}/{description}/{breed}/{healthConcerns} – again, this method calls the one above, setting “photoURL” and “apartment” to null.
/profile/{ID}/{name}/{type}/{description} – the least specific pet profile case. Creates a profile with only the basic name, type of animal, brief description of nearly any sort, and of course a unique ID. Uses the method above once again.
DTO stands for Data Transfer Object, a wrapper class of sorts used to encapsulate information of an object and interact with RESTful API.
All RESTful service URLs may be followed by an ending ‘/’ and still result in the same function.