Pawsitively Purrfect GraphQL API Reference
Welcome to Pawsitively Purrfect..!
API Endpoints
# Development:
http://pawsitively.purrfect:62783/graphql
# Production:
http://pawsitively.purrfect:62783/graphql
Queries
findPets
Description
Find pets accross platform based on search criteria
Response
Returns [Pet]
Example
Query
query FindPets(
$breed: String,
$gender: Gender,
$shelterID: ID,
$adoptionStatus: AdoptionStatus,
$name: String,
$type: PetType
) {
findPets(
breed: $breed,
gender: $gender,
shelterID: $shelterID,
adoptionStatus: $adoptionStatus,
name: $name,
type: $type
) {
adoptionStatus
breed
currentOwnerID
gender
id
name
photo
shelterID
type
}
}
Variables
{
"breed": "xyz789",
"gender": "Male",
"shelterID": "4",
"adoptionStatus": "Available",
"name": "abc123",
"type": "Cat"
}
Response
{
"data": {
"findPets": [
{
"adoptionStatus": "Available",
"breed": "xyz789",
"currentOwnerID": 4,
"gender": "Male",
"id": 4,
"name": "abc123",
"photo": "xyz789",
"shelterID": 4,
"type": "Cat"
}
]
}
}
listPets
Description
List all pets owned by logged-in user
Response
Returns [Pet]
Example
Query
query ListPets {
listPets {
adoptionStatus
breed
currentOwnerID
gender
id
name
photo
shelterID
type
}
}
Response
{
"data": {
"listPets": [
{
"adoptionStatus": "Available",
"breed": "xyz789",
"currentOwnerID": "4",
"gender": "Male",
"id": 4,
"name": "abc123",
"photo": "xyz789",
"shelterID": 4,
"type": "Cat"
}
]
}
}
listShelterPets
Description
List pets by shelter
Response
Returns [Pet]
Arguments
Name | Description |
---|---|
shelterID - ID!
|
|
adoptionStatus - AdoptionStatus
|
Example
Query
query ListShelterPets(
$shelterID: ID!,
$adoptionStatus: AdoptionStatus
) {
listShelterPets(
shelterID: $shelterID,
adoptionStatus: $adoptionStatus
) {
adoptionStatus
breed
currentOwnerID
gender
id
name
photo
shelterID
type
}
}
Variables
{
"shelterID": "4",
"adoptionStatus": "Available"
}
Response
{
"data": {
"listShelterPets": [
{
"adoptionStatus": "Available",
"breed": "xyz789",
"currentOwnerID": "4",
"gender": "Male",
"id": "4",
"name": "xyz789",
"photo": "xyz789",
"shelterID": "4",
"type": "Cat"
}
]
}
}
listShelters
Description
List shelters by filter
Response
Returns [Shelter]
Example
Query
query ListShelters(
$description: String,
$website: String,
$location: String,
$ownerID: ID,
$name: String
) {
listShelters(
description: $description,
website: $website,
location: $location,
ownerID: $ownerID,
name: $name
) {
contactInformation
description
id
location
logo
name
numberOfPets
ownerID
website
}
}
Variables
{
"description": "abc123",
"website": "xyz789",
"location": "xyz789",
"ownerID": 4,
"name": "abc123"
}
Response
{
"data": {
"listShelters": [
{
"contactInformation": "xyz789",
"description": "abc123",
"id": "4",
"location": "xyz789",
"logo": "abc123",
"name": "xyz789",
"numberOfPets": 123,
"ownerID": "4",
"website": "xyz789"
}
]
}
}
pet
Description
Get a pet by ID.
Example
Query
query Pet($id: ID!) {
pet(id: $id) {
adoptionStatus
breed
currentOwnerID
gender
id
name
photo
shelterID
type
}
}
Variables
{"id": "4"}
Response
{
"data": {
"pet": {
"adoptionStatus": "Available",
"breed": "xyz789",
"currentOwnerID": "4",
"gender": "Male",
"id": 4,
"name": "abc123",
"photo": "abc123",
"shelterID": "4",
"type": "Cat"
}
}
}
profile
Description
Get logged-in user profile
Response
Returns a User
Example
Query
query Profile {
profile {
avatar
bio
email
firstName
id
isActive
isAdmin
lastName
location
username
}
}
Response
{
"data": {
"profile": {
"avatar": "abc123",
"bio": "xyz789",
"email": "abc123",
"firstName": "xyz789",
"id": "4",
"isActive": false,
"isAdmin": false,
"lastName": "xyz789",
"location": "xyz789",
"username": "abc123"
}
}
}
shelter
Description
Get a shelter by ID.
Example
Query
query Shelter($id: ID!) {
shelter(id: $id) {
contactInformation
description
id
location
logo
name
numberOfPets
ownerID
website
}
}
Variables
{"id": 4}
Response
{
"data": {
"shelter": {
"contactInformation": "abc123",
"description": "xyz789",
"id": "4",
"location": "xyz789",
"logo": "xyz789",
"name": "abc123",
"numberOfPets": 987,
"ownerID": 4,
"website": "abc123"
}
}
}
user
Description
Get a user by ID.
Example
Query
query User(
$id: ID,
$name: String
) {
user(
id: $id,
name: $name
) {
avatar
bio
email
firstName
id
isActive
isAdmin
lastName
location
username
}
}
Variables
{
"id": "4",
"name": "xyz789"
}
Response
{
"data": {
"user": {
"avatar": "abc123",
"bio": "xyz789",
"email": "abc123",
"firstName": "abc123",
"id": "4",
"isActive": false,
"isAdmin": false,
"lastName": "xyz789",
"location": "abc123",
"username": "xyz789"
}
}
}
Mutations
addPet
Description
Add new pet to a shelter
Response
Returns a Pet
Example
Query
mutation AddPet(
$gender: Gender,
$shelterID: ID!,
$name: String!,
$type: PetType!,
$breed: String
) {
addPet(
gender: $gender,
shelterID: $shelterID,
name: $name,
type: $type,
breed: $breed
) {
adoptionStatus
breed
currentOwnerID
gender
id
name
photo
shelterID
type
}
}
Variables
{
"gender": "Male",
"shelterID": "4",
"name": "xyz789",
"type": "Cat",
"breed": "abc123"
}
Response
{
"data": {
"addPet": {
"adoptionStatus": "Available",
"breed": "xyz789",
"currentOwnerID": "4",
"gender": "Male",
"id": "4",
"name": "abc123",
"photo": "abc123",
"shelterID": 4,
"type": "Cat"
}
}
}
addShelter
Description
Add new shelter to the system
Response
Returns a Shelter
Example
Query
mutation AddShelter(
$contactInformation: String,
$name: String!,
$description: String,
$website: String,
$location: String
) {
addShelter(
contactInformation: $contactInformation,
name: $name,
description: $description,
website: $website,
location: $location
) {
contactInformation
description
id
location
logo
name
numberOfPets
ownerID
website
}
}
Variables
{
"contactInformation": "abc123",
"name": "xyz789",
"description": "xyz789",
"website": "xyz789",
"location": "abc123"
}
Response
{
"data": {
"addShelter": {
"contactInformation": "xyz789",
"description": "xyz789",
"id": "4",
"location": "abc123",
"logo": "xyz789",
"name": "abc123",
"numberOfPets": 987,
"ownerID": "4",
"website": "abc123"
}
}
}
adoptPet
Description
Adopt pet from a shelter
Example
Query
mutation AdoptPet($petID: ID) {
adoptPet(petID: $petID) {
adoptionStatus
breed
currentOwnerID
gender
id
name
photo
shelterID
type
}
}
Variables
{"petID": 4}
Response
{
"data": {
"adoptPet": {
"adoptionStatus": "Available",
"breed": "xyz789",
"currentOwnerID": 4,
"gender": "Male",
"id": 4,
"name": "abc123",
"photo": "xyz789",
"shelterID": "4",
"type": "Cat"
}
}
}
deleteShelter
Description
Delete a shelter
login
Description
Login user to the system
Example
Query
mutation Login(
$password: String!,
$username: String!
) {
login(
password: $password,
username: $username
) {
avatar
bio
email
firstName
id
isActive
isAdmin
lastName
location
username
}
}
Variables
{
"password": "xyz789",
"username": "abc123"
}
Response
{
"data": {
"login": {
"avatar": "abc123",
"bio": "abc123",
"email": "xyz789",
"firstName": "abc123",
"id": 4,
"isActive": false,
"isAdmin": true,
"lastName": "abc123",
"location": "abc123",
"username": "abc123"
}
}
}
register
Description
Register a new user to the system
Response
Returns a User
Example
Query
mutation Register(
$username: String!,
$email: String!,
$password: String!
) {
register(
username: $username,
email: $email,
password: $password
) {
avatar
bio
email
firstName
id
isActive
isAdmin
lastName
location
username
}
}
Variables
{
"username": "xyz789",
"email": "xyz789",
"password": "xyz789"
}
Response
{
"data": {
"register": {
"avatar": "abc123",
"bio": "abc123",
"email": "xyz789",
"firstName": "abc123",
"id": "4",
"isActive": false,
"isAdmin": true,
"lastName": "xyz789",
"location": "abc123",
"username": "xyz789"
}
}
}
updatePet
Description
Update pet information
Response
Returns a Pet
Example
Query
mutation UpdatePet(
$name: String!,
$type: PetType!,
$breed: String,
$gender: Gender,
$id: ID!
) {
updatePet(
name: $name,
type: $type,
breed: $breed,
gender: $gender,
id: $id
) {
adoptionStatus
breed
currentOwnerID
gender
id
name
photo
shelterID
type
}
}
Variables
{
"name": "xyz789",
"type": "Cat",
"breed": "xyz789",
"gender": "Male",
"id": 4
}
Response
{
"data": {
"updatePet": {
"adoptionStatus": "Available",
"breed": "xyz789",
"currentOwnerID": 4,
"gender": "Male",
"id": 4,
"name": "xyz789",
"photo": "abc123",
"shelterID": "4",
"type": "Cat"
}
}
}
updateProfile
Description
Update user profile
Response
Returns a User
Example
Query
mutation UpdateProfile(
$email: String!,
$firstName: String,
$lastName: String,
$bio: String,
$location: String,
$avatar: String,
$id: ID!,
$username: String!
) {
updateProfile(
email: $email,
firstName: $firstName,
lastName: $lastName,
bio: $bio,
location: $location,
avatar: $avatar,
id: $id,
username: $username
) {
avatar
bio
email
firstName
id
isActive
isAdmin
lastName
location
username
}
}
Variables
{
"email": "xyz789",
"firstName": "xyz789",
"lastName": "xyz789",
"bio": "abc123",
"location": "abc123",
"avatar": "abc123",
"id": "4",
"username": "xyz789"
}
Response
{
"data": {
"updateProfile": {
"avatar": "xyz789",
"bio": "xyz789",
"email": "abc123",
"firstName": "abc123",
"id": 4,
"isActive": true,
"isAdmin": false,
"lastName": "xyz789",
"location": "xyz789",
"username": "abc123"
}
}
}
updateShelter
Description
Update shelter information
Response
Returns a Shelter
Example
Query
mutation UpdateShelter(
$location: String,
$contactInformation: String,
$id: ID!,
$name: String!,
$description: String,
$website: String
) {
updateShelter(
location: $location,
contactInformation: $contactInformation,
id: $id,
name: $name,
description: $description,
website: $website
) {
contactInformation
description
id
location
logo
name
numberOfPets
ownerID
website
}
}
Variables
{
"location": "abc123",
"contactInformation": "abc123",
"id": 4,
"name": "abc123",
"description": "xyz789",
"website": "abc123"
}
Response
{
"data": {
"updateShelter": {
"contactInformation": "xyz789",
"description": "abc123",
"id": "4",
"location": "abc123",
"logo": "xyz789",
"name": "xyz789",
"numberOfPets": 123,
"ownerID": 4,
"website": "abc123"
}
}
}
Types
AdoptionStatus
Values
Enum Value | Description |
---|---|
|
|
|
Example
"Available"
Boolean
Description
The Boolean
scalar type represents true
or false
.
Example
true
Gender
Values
Enum Value | Description |
---|---|
|
|
|
Example
"Male"
ID
Description
The ID
scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4"
) or integer (such as 4
) input value will be accepted as an ID.
Example
"4"
Int
Description
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
Example
123
Pet
Example
{
"adoptionStatus": "Available",
"breed": "abc123",
"currentOwnerID": 4,
"gender": "Male",
"id": "4",
"name": "abc123",
"photo": "xyz789",
"shelterID": 4,
"type": "Cat"
}
PetType
Values
Enum Value | Description |
---|---|
|
|
|
Example
"Cat"
Shelter
Example
{
"contactInformation": "abc123",
"description": "abc123",
"id": "4",
"location": "abc123",
"logo": "abc123",
"name": "xyz789",
"numberOfPets": 987,
"ownerID": 4,
"website": "abc123"
}
String
Description
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
Example
"xyz789"
User
Example
{
"avatar": "xyz789",
"bio": "abc123",
"email": "abc123",
"firstName": "abc123",
"id": "4",
"isActive": true,
"isAdmin": true,
"lastName": "abc123",
"location": "abc123",
"username": "xyz789"
}