Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Eric Park
1,063 PointsWhat is an API Endpoint?
What is an API endpoint? I am currently working on the Javascript FullStack program, but had a quick question on APIs?
2 Answers
Kris Phelps
7,609 PointsAn API is an Application Programming Interface. It's a way to interact with web services. The way you interact with those web services is by sending messages that conform to their specification. You send those messages to their "endpoints". You can think of an endpoint as a fancy name for URL.
For example, in your application, let's say you want to retrieve a stock quote from Yahoo for Microsoft. Yahoo offers an API endpoint (https://finance.yahoo.com/example/api/endpoint/) that you can send your request to, then they would respond to your request with the stock quote for Microsoft.
Eric Park
1,063 PointsCool thanks! Is the endpoint the base url that we configure than? For example in the stock quote example, we can use "https://finance.yahoo.com/example/api/endpoint/author" to get the quote's author? While the endpoint is actually: "https://finance.yahoo.com/example/api/endpoint/"
Kris Phelps
7,609 PointsThat all depends on how the endpoint(s) was/were designed. Some might work the way you described, where to get the "author" you would need to query /author, but others might be setup where there is just one endpoint and the response changes based on your request.
A simpler API might only have one endpoint that you hit and it responds with everything, whereas a more complex service might have multiple endpoints that each do something different.