JS-151-API
  • JavaScript Library
  • 02-DOM-Manipulation
    • Overview
    • DOM Explained
    • Example Setup
    • Selecting Elements
    • Events
    • Complete Example
  • 03-API Fundamentals
    • 0-Getting Started
      • Welcome
    • 1-Intro-To-APIs
      • Intro
      • Client
      • Requests
      • JSON
      • API Endpoints
      • Server
      • Response
      • Statelessness
      • REST
    • 2-Asynchronous-Programming
      • Intro
      • Callbacks
      • Promises
      • Promises Continued
      • Chaining Promises
    • 3-Fetch
      • Fetch Intro
      • Star Wars
        • Star Wars API
        • Star Wars Setup
        • Star Wars JS
      • Random Photo
        • Unsplash
        • Unsplash Setup
        • Unsplash JS
    • 4-Apps
      • 01-New York Times
        • 00-App Intro
        • 01-HTML/CSS/API Key
        • 02-Variables
        • 03-Event Listeners
        • 04-fetchResults
          • 01-fetchResults()
          • 02-preventDefault()
          • 03-fetch() method
          • 04-Dates
        • 05-displayResults
          • 01-Logging JSON
          • 02-Working with JSON
          • 03-Link Display
          • 04-Results Navigation
          • 05-Results Update
          • 06-Keywords
          • 07-Images
        • 06-Pagination
          • 01-Pagination Intro
          • 02-Pagination Functions
        • 07-Next Steps
      • 02-YouTube
        • html
        • youtube.css
        • youtube.js
      • 03-GoogleMaps
        • Setup
        • HTML and CSS files
        • API Key
        • JS Setup
        • Adding Your Location
        • Listeners
        • Custom Options
Powered by GitBook
On this page
  • What is an Endpoint?
  • Examples
  • Summary
  1. 03-API Fundamentals
  2. 1-Intro-To-APIs

API Endpoints

PreviousJSONNextServer

Last updated 7 years ago

So we know how to communicate with the server, but how do we know where to go on the server? We use API Endpoints!

What is an Endpoint?

An API Endpoint is the url that the client application uses to communicate with your server. It's the path it takes step-by-step page-by-page.

Endpoints are constantly referred to in the development world. Most API documentation is where you would find endpoint information for all publicly accessible APIs. Endpoints are also what you'll create in the future, when developing APIs. It's where all clients make requests to, to get certain information.

But what exactly does it look like? Let's look at an example.

Examples

Let's say you wanted to see a post you made in your High School Alumni Facebook Group. What might that API endpoint look like?

https://api.facebook.com/users/{userId}/groups/{groupId}/posts/{postId}

Keep in mind that this is a completely hypothetical example and is likely not how the Facebook API is actually designed.

Believe it or not, Spotify has some great documentation for their API! Let's look at a few specific examples:

  • All urls begin with

  • Get an artist's top tracks:

    • endpoint is: /v1/artists/{id}/top-tracks

  • Follow a playlist:

    • endpoint is: /v1/users/{owner_id}/playlists/{playlist_id}/followers

  • Create a playlist:

    • endpoint is: /v1/users/{user_id}/playlists

  • Remove tracks from a playlist

    • endpoint is: /v1/users/{user_id}/playlists/{playlist_id}/tracks

  • What HTTP verb would each endpoint use?

  • You can find more information regarding Spotify's API .

Summary

Endpoints are just a URL that the API developer decides, where clients can access specific information.

https://api.spotify.com
here