Working with APIs

A query has a few core components:

  • endpoint
  • path
  • query parameters

endpoint

  • represent where a resource lives
  • the first part of a query phrase
  • Example: https://api.thecatapi.com/

    path

    • further specifies what part of the resource you want
    • there's no rule to the terms or order used (each resource is different) but there are conventions
    Example: https://api.thecatapi.com/v1/images/search

    query parameters

    • indicate how you want things to be presented to you
  • further specify the characteristics of what you are looking for
  • informed by convention rather than a rule
    Example: https://api.thecatapi.com/v1/images/search?category_ids=5&format=src
  • Activity:

    Show and tell a cat with TheCatAPI

    https://api.thecatapi.com/