Skip to content
Alastair Paragas edited this page Mar 22, 2015 · 8 revisions

Introduction

The Pttr Backend API unifies all the legacy API systems currently out in the United States into one unified API layer for both internal use by Pttr mobile and web apps as well as for the free use of the developer community to create better solutions for animal shelters.

You can choose to deploy the unified Pttr API layer to your server, or use our currently running service, currently accessible at http://pttrapp.com/api/v1.

JSON and CORS

The API outputs data in JSON and our service currently accepts CORS. If you need responses returned in JSONP format, make sure to pass a callback parameter with the name of the function you want your response wrapped with,

e.g: http://pttrapp.com/api/v1/shelters?city=Miami,FL&callback=someCallbackFunction.

GET Parameters

Service-wide, all API endpoints accept these parameters:

  • city
  • zipcode
  • limit
  • page

/shelters endpoint accepts these parameters:

  • name

/animals endpoint accepts these parameters:

  • sex
  • species

Response Structure

URL endpoints

There are 4 URL endpoints

  • /animals - Returns a collection of Animal Objects
  • /animal/<id> - Returns an Animal Object, given an identifier
  • /shelters - Returns a collection of Shelter Objects
  • /shelter/<id> - Returns a Shelter Object, given an identifier

Each response object comes with 4 properties:

  • status - ok for API calls that went without a hitch, error otherwise
  • message - message about the API call, frequently contains information about the API call along with the status property
  • results - Results of the API call
  • count - A count of the returned results

Animal Object

The /animals endpoint returns a collection of Animal objects and the /animal endpoint returns an Animal object. Animal Objects have the following properties:

  • name - Name of the Animal
  • id - caseId for the Animal, delimited by <someApi>- which allows one to determine which remote API the animal's information was obtained from.
  • belongsToShelter - ID of shelter this Animal belongs to
  • description - Description of the Animal
  • species - Is the Animal a dog? cat? bird?
  • breed - What is the Animal's specific breed (for example if dog, German Shepherd)?
  • sex - Is the Animal male or female?
  • color - Animal's color
  • status - dead or alive?
  • age - Animal's age
  • pictures
    • thumbnail - small thumbnail picture of the animal
    • largePicture - high resolution picture of the animal

Shelter Object

The /shelters endpoint returns a collection of Shelter objects and the /shelter endpoint returns an Shelter object. Shelter Objects have the following properties:

  • name - Name of the Shelter
  • address - Address of the Shelter
  • city - City of the Shelter
  • state - State of the Shelter
  • zipcode - Zipcode of the Shelter
  • country - Country of the Shelter
  • id - Identifier for the Shelter, delimited by <someApi>- which allows one to determine which remote API the shelter's information was obtained from.
  • email - Primary contact email for the shelter
  • orgUrl - URL that explains more information about the shelter