API Endpoints

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 https://api.spotify.com

  • 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 here.

Summary

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

Last updated