API V1

Version 1 of the PetHub Open API

By PetHub, 24 January, 2023

The /tags endpoint focuses on the ID tags registered on PetHub.com.

Digging into /Tags

The /tags endpoint offers the following:

/tags Description
/{tid}
  • POST - link a pet to an ID tag
  • GET - get the public profile as published by the pet owner
  • PUT - assign the tag to another pet or to NULL
/{tid}/activity GET - returns list of activities for a specific ID
Example:
https://pethub.io/v1/tags/A2B3C4?type=gps
/{tid}/info

GET - returns the tag ID, pet ID and datetime it was linked

/{tid}/issuer GET - returns the municipality, veterinarian or co-branding client name

The Swagger 2.0 / OAS YAML rendering is below including the data structures necessary for POST or returned by GET.

By PetHub, 24 January, 2023

The /species endpoint focuses on the species known to PetHub.com, their internal ID on PetHub, and additional details about the particular species. Use this list to help when creating a pet profile or lost pet poster to be added to the website.

Digging into /Species

The /species endpoint offers the following:

/species Description
/

GET - list of animal species available on PetHub to help with creating a pet profile

/{species}

GET - returns additional details about the species type

/{species}/breeds GET - returns the list of breeds for a particular species

The Swagger 2.0 / OAS YAML rendering is below including the data structures necessary for POST or returned by GET.

By PetHub, 23 January, 2023

The /Perks endpoint focuses on the current list of lost pets posted on PetHub.com. Use this to create, read/pull, update and delete Lost Pet Posters.

Digging into /Perks

The /perks endpoint offers the following:

/perks Description
/  
/{perkid}
  • GET
  • PUT
  • DELETE
   
   

The Swagger 2.0 / OAS YAML rendering is below including the data structures necessary for POST or returned by GET.

Category
By PetHub, 23 January, 2023

The /LostPets endpoint focuses on the current list of lost pets posted on PetHub.com. Use this to create, read/pull, update and delete Lost Pet Posters.

Digging into /LostPets

The /lostpets endpoint offers the following:

/lostpets Description
/
  • POST - create a lost pet poster
  • GET - pull a list of lost pet posters and their {posterId}
    Examples:
    https://pethub.io/v1/lostpets?state=wa&city=seattle&species=dog
/{posterId}
  • GET - retrieve the details of a specific poster
  • PUT - update a lost pet poster's details
  • DELETE - remove a lost pet poster
/{posterId}/share
  • POST - specify which channels to share the poster
  • GET - retrieve a list of channels (Facebook, Twitter, etc.) in which the poster has been shared
/{posterId}/pdf GET - retrieve a link to a PDF version of the lost pet poster

The Swagger 2.0 / OAS YAML rendering is below including the data structures necessary for POST or returned by GET.

Category
By PetHub, 23 January, 2023

The /foods endpoint focuses on the types of pet food that is recognized by and can be recorded on PetHub.com for a pet's nutritional needs. Use this to pull the types of foods available and details about a specific food ID (fid).

Digging into /Foods

The /foods endpoint offers the following:

/foods Description
/
  • POST - add a food to PetHub's list of foods, types, etc.
  • GET - list of foods available on PetHub
    Example:
    https://pethub.io/v1/foods?manufacturer=mars&type=kibble
/{fid}
  • GET - retrieve manufacturer, brand, type, name, and so on
  • PUT - update information about a food entry
  • DELETE - remove a food entry from the database
/{fid}/use GET - get the list of pets using food {fid}
Example:
https://pethub.io/v1/foods/{fid}/use?state=wa&city=seattle
  (Actively seeking feedback re: additional endpoints & use cases)
   

The Swagger 2.0 / OAS YAML rendering is below including the data structures necessary for POST or returned by GET.

By PetHub, 23 January, 2023

The /activities endpoint provides a current list of supported activity types.

Digging into /Activities

The /activities endpoint offers the following:

/activities Description
/ GET - returns a list of supported activity types
/{aid}
  • GET - returns detailed information about the activity identified by the activity ID
  • PUT - updates an activity entry
  • DELETE - deletes an activity entry

The Swagger 2.0 / OAS YAML rendering is below including the data structures necessary for POST or returned by GET.

By PetHub, 1 January, 2023

The /types endpoint focuses on the types of data that can be associated with a pet's profile on PetHub.com. Use this to retrieve the list of type names and unique IDs to associate with a pet's profile information.

This endpoint:

By PetHub, 1 January, 2023

The HTTP response status codes that PetHub API utilizes are currently:

  • 200 - OK
  • 201 - Created
  • 400 - Bad request
  • 404 - Not found
  • 500 - Internal server error

In addition to returning an HTTP response to a request to a PetHub.io API, we hope to actually provide some helpful information in the event of an error (but, if we miss that mark, please let us know so we can do our best to address it).

Request Errors

In addition to the HTTP response code above being returned, when an error occurs we will endeavor to have it include the following fields to help you (and possibly us) in diagnosing the problem:

  • response_code - HTTP status code (see above)
  • message - verbose, plain language description of the problem with hints of how to fix it
  • more_info - link to any supporting documentation
  • code - API error code defined in the PetHub API documentation to further identify the issue

For example, let's attempt to look-up the information for our beloved Grizzly (the original tester dog) where an access token is not included in the Header of the request:

curl GET https://pethub.io/v1/pets/321

Should have been:
curl -H "Authorization: Bearer abc123" GET https://pethub.io/v1/pets/321

The response would look something like the following:

HTTP Status Code: 401

{
    "response_code" : "401",
    "message" : "Header is missing or includes an invalid access token",
    "more_info" : "https://pethub.io/api/v1/auth,https://pethub.io/errors/202201100",
    "code" : "202201100"
}

 

By PetHub, 1 January, 2023

Helpful API provided by Petfinder (requires API key sign-up).

Swagger 2.0 File
Category
By PetHub, 1 January, 2023

The /pets endpoint focuses on the pet profile on PetHub.com. Use this to create a pet profile, retrieve a pet's information, and update its details as documented here.

The main parameter of this endpoint is the pet ID {pid} which is a UUID for a pet.

Digging into /Pets

The /pets endpoint offers the following:

/pets Description
/

POST - creates a new pet profile

/{pid}
  • GET - returns basic profile information such as name, photo, breed, species, age, description, and so on
  • PUT - updates a pet's basic profile information
  • DELETE - deletes a pet's basic profile and causes all associated data to be deleted as well (e.g. activities, allergies, documents, conditions, foods, medications, etc.)
/{pid}/activities
  • POST - add an activity for a pet
  • GET - return list of activities for a specific pet
  • DELETE - remove an activity for the pet
/{pid}/allergies
  • POST - add an allergy entry for a pet
  • GET - returns a list of allergies associated with a pet
  • PUT - updates a pet's existing allergy information
  • DELETE - deletes the pet's specified allergy entry
/{pid}/conditions
  • POST - add a condition entry for a pet
  • GET - returns a list of conditions for the specified pet
  • PUT - updates a pet's existing condition information
  • DELETE - deletes the pet's specified condition entry
/{pid}/documents
  • POST - add a file to a pet's profile
  • GET - list of documents associated with the pet
  • DELETE - remove a document from the website and pet's profile
/{pid}/foods
  • POST - add a food entry for a pet's diet
  • GET - retrieve a list of foods on a pet's diet
  • PUT - update a pet's food regimen
  • DELETE - remove the food entry from the pet's profile
/{pid}/medications
  • POST - Add a medication entry for a pet
  • GET - retrieve a list of medications and their details for a pet
  • PUT - update a medication entry for a pet
  • DELETE - remove a medication from the pet's profile
/{pid}/procedures
  • POST - add a medical procedure entry for a pet
  • GET - returns a list of medical procedures associated with this pet
  • PUT - update the medical procedure entry
  • DELETE - remove a procedure from the pet's profile
/{pid}/tags
  • POST - links a tag to the pet
  • GET - returns a list of IDs linked to the pet's profile
  • DELETE - unlink the tag from the pet's profile

The Swagger 2.0 / OAS YAML rendering is below including the data structures necessary for POST or returned by GET.

Swagger 2.0 File