Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

What is API, Web API, Web service, etc?

I used an API before (darksky). But I realize, I don't really get what an API means. Can anyone explain it?

I also notice there are Web API, Web service, Restful API. Are they the same thing or not?

4 Answers

If memory serves correct, it's Application *Programming Interface. It is a way to interface with the database connected to a website. For example, if you make a Weather API, you can "call" a website and retrieve updated information about the current temperature. Restful API, if I'm not mistaken, is a safe way for websites to allow web developers access to their database. The content the developer is interacting with can not be changed by them. Only a GET command can be used. As for web service, I believe this refers to a website releasing the information to developers so that they may access the database. For example, I think you can use Instagram's API to create an RSS feed that updates all the pictures uploaded to Instagram in a certain location.

Bolaji Salau
Bolaji Salau
7,980 Points

API (Application Programming Interface) are those set of rules that describe how a code or a program can be written to demonstrate or exhibit behavior as stated in those rules. So the question is what do I mean by "Set of Rules"? The set of rules are those specification such as methods or functions .i.e In a web service definition you can have methods that render different kinds of service. To consume any of the methods a caller must comply with the signature of the method being consumed. The method in this case are the APIs for the web service.

Jessica Cottner Bolaji Salau Thanks for joining the discussion.

It's still a bit confusing for me. So is DarkSky is one example of Restful API? because we can only GET the data not change the data?

Is API only exist on web apps? How about Android API?

Bolaji Salau
Bolaji Salau
7,980 Points

I ll suggest you read on the product documentation for DarkSky to start with, that will help clarify the kind of API it is or not. Within the context you have described "we can only GET the data not change the data?", yes, you can only get the response (data) after execution of the service consumption (method call). The method called, is a method or function of an object/class or an interface definition e.g (public String getAccountBalance(String accountNumber)). So to get an account balance, a caller will need to pass in an account number into the getAccountBalance method for the getAccountBaalance method to produce the account balance on the particular account.

API applies to other things apart from web apps, API is more of an abstraction of the services or features one can expect from an application (either standalone or web), web service, a game, a programming language (Java), a technology (Android).