Why it is important and how to get started working with them? Please provide non technical analogies as I already have tried but don't understand them.
For further actions, you may consider blocking this person and/or reporting abuse
Why it is important and how to get started working with them? Please provide non technical analogies as I already have tried but don't understand them.
For further actions, you may consider blocking this person and/or reporting abuse
Niaxus -
Syakir -
Thomas Hansen -
Jimmy McBride -
Top comments (2)
Quite simply, an API is a set of clearly defined rules for how to interact with something.
As an analogy, think for a moment about doors. There are some pretty specific ways you can interact with a door. Suppose you have a hinged door with a deadbolt lock and a latch operated by a rotating handle that has it's own integrated locking mechanism (essentially, what you might expect to find in many parts of the world as the front door of an apartment or a house). With such a door, you have the following properties that are inherent to the door:
And you have the following possible interactions:
That list of properties and possible interactions is, in essence, an API for interacting with this door. The interactions themselves are methods or functions, and the properties may take on various form depending on the exact nature of the API (they may be actual properties, or they might be accessed through special 'get' methods, or some could even just be included automatically as part of the result of using any of the other methods).
Having a well defined set of interactions like this is really important in life in general, not just programming, because it ensures consistency of results. Think for example of how we rely on the 'API' of basic physics every day to go about our lives. If gravity suddenly stopped working, or only worked if you did certain things, life would be really hard.
As far as actually using them, if you're doing any sort of programming, you already are, you just aren't thinking about it. A programming language, is, itself, an API. It defines how you tell the computer to do what you want it to do so that you can get the results you expect. For example, if you do front end web development, then the stuff in JavaScript that you use to interact with the actual HTML of the web page is an API.
Omgosh...thank you so much for your effort to make such a detailed explanation. I think I'm getting an intuitive feeling of APIs now