|
38 | 38 | API in a nutshell |
39 | 39 | ///////////////// |
40 | 40 | • An API stands for Application Programming Interface, which is a fancy way of saying what one application exposes to another. |
| 41 | + • A better way to think about API's is that it is a CONTRACT between two things and how they interact with each other. |
41 | 42 |
|
42 | 43 | • Think of a restaurant as an analogy of an API. |
43 | 44 | • You dont go staight up to the chef to place your order, you need to look at the menu and order something from there because that |
@@ -66,7 +67,24 @@ API in a nutshell |
66 | 67 | and wants to let you modify. |
67 | 68 | • For example, you could update a user through a REST API, but they will only let you update the password and email... not the name. |
68 | 69 | • You could also get users from this API, but they will not return the passwords of those users. |
69 | | - • Again, the servers are secure because they only expose the information they want to expose. |
| 70 | + • Again, the servers are secure because they only expose the information they want to expose through this API. |
| 71 | + • In other words, the API is the contract between the server and the client. |
| 72 | +
|
| 73 | + • Libraries are another common form of API that pulls a specific code library into your own code. |
| 74 | + • Libraries have many methods definined in them that do specific things when you call them and return specific data when you call them. |
| 75 | + • This is an API as its a contract between the library code you've installed and your project that's using the library. |
| 76 | + • When using library API's, you have: |
| 77 | + • Different ways of accessing it (i.e. loading into your project, meta, etc.) |
| 78 | + • You can only use the methods that they expose (i.e. jquery library, etc) |
| 79 | + • You cannot access the internals of that library unless its through the methods of the API library exposed to you. |
| 80 | +
|
| 81 | + • The common theme of API's is that they only expose what they want you to be able to acess and hide everything else to make it as secure as possible. |
| 82 | + • Also common with API's is some sort of TOKEN to authenticate yourself with the API, which allows the application to know who's accessing it and limit |
| 83 | + what that person can access based on specific permissions. |
| 84 | +
|
| 85 | +
|
| 86 | +
|
| 87 | +
|
70 | 88 |
|
71 | 89 |
|
72 | 90 |
|
|
0 commit comments