Giter Site home page Giter Site logo

cs361_petfinder_ms's Introduction

CS361_PetfinderAPI_MS

This microservice makes a call to the Petfinder API and returns pet information in the form of JSON.

Prerequisites

  • Python: Version 3.x (recommended 3.7 or later)
  • Flask: A micro web framework written in Python. Flask can be installed via pip, Python's package installer.
  • Requests Library: A Python HTTP library, used for making API calls. Also installable via pip.
  • Petfinder API Key and Secret: You must have a registered Petfinder account to obtain an API key and secret necessary for making authenticated requests to the Petfinder API.

Using the Microservice

Requesting Data

Information can be fetched from the microservice through several methods, including using a web browser (for simple GET requests) or a command-line tool like curl.

Web Browser

  1. Open a web browser.
  2. Enter the full URL into your browser's address bar.
  3. The default Flask port is 5000, so in this example, enter http://127.0.0.1:5000/.
  4. A GET request to the /pets endpoint to retrieve a JSON response with 5 cats: http://127.0.0.1:5000/pets?type=cat&limit=5.

Using curl

curl is a command-line tool to make web requests. To make the same request as above using curl, you would open a terminal or command prompt and enter the following command:

curl "http://127.0.0.1:5000/pets?type=cat&limit=5"

This command performs a GET request to the microservice's /pets endpoint with the query parameters (type=cat&limit=5). The microservice processes this request and returns a JSON response with data on 5 cats, which is displayed in the terminal.

Receiving Data

The microservice will respond with JSON-formatted data representing the requested pets. Below is an example of what this looks like.

{
  "animals": [
    {
      "_links": {
        "organization": {
          "href": "/v2/organizations/ga38"
        },
        "self": {
          "href": "/v2/animals/70825338"
        },
        "type": {
          "href": "/v2/types/dog"
        }
      },
      "age": "Adult",
      "attributes": {
        "declawed": null,
        "house_trained": false,
        "shots_current": true,
        "spayed_neutered": true,
        "special_needs": false
      },
      "breeds": {
        "mixed": true,
        "primary": "Pit Bull Terrier",
        "secondary": null,
        "unknown": false
      },
      "coat": null,
      "colors": {
        "primary": null,
        "secondary": null,
        "tertiary": null
      },
      "contact": {
        "address": {
          "address1": "251 Automation Drive",
          "address2": null,
          "city": "Carrollton",
          "country": "US",
          "postcode": "30117",
          "state": "GA"
        },
        "email": null,
        "phone": "770-214-3590 "
      },
      "description": "Toga is a 7.5 year old Pit mix who is extremely sweet, playful, and loving. Toga loves to smile all...",
      "distance": null,
      "environment": {
        "cats": null,
        "children": null,
        "dogs": null
      },
      "gender": "Male",
      "id": 70825338,
      "name": "Toga",
      "organization_animal_id": "20255945",
      "organization_id": "GA38",
      "photos": [],
      "primary_photo_cropped": null,
      "published_at": "2024-02-23T09:55:46+0000",
      "size": "Medium",
      "species": "Dog",
      "status": "adoptable",
      "status_changed_at": "2024-02-23T09:55:47+0000",
      "tags": [],
      "type": "Dog",
      "url": "https://www.petfinder.com/dog/toga-70825338/ga/carrollton/carroll-county-animal-shelter-ga38/?referrer_id=fd8b497a-af59-458a-b6d9-383b5e2f8682&utm_source=api&utm_medium=partnership&utm_content=fd8b497a-af59-458a-b6d9-383b5e2f8682",
      "videos": []
    }

UML Diagram

mermaid-diagram-2024-02-25-105310

cs361_petfinder_ms's People

Contributors

johnmel3 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.