Intro to APIs Flashcards
What is the purpose of an API?
To provide abstraction to simplify connections between backend and UI.
What are the 4 primary components of an API?
- API key
- API documentation
- Requests
- Responses
What is an API key?
Identification mechanism to allow specific access to data.
What is API documentation?
The instructions for how to interface with an API.
What is an API request?
A packet of information being sent to the program that you are blind to.
What is an API response?
Feedback from the request, typically a JSOn file (REST APIs).
What is contained in a RESTful API request?
- Header: contains API key
- Operations: CRUD / HTTP
- Endpoints: resources
- Parameters / body: Data in request
What are the CRUD operations?
- Create
- Read
- Update
- Delete
What are the most common HTTP methods?
- Post
- Get
- Put
- Patch
- Delete
What are the repsonses to the common HTTP methods?
- POST: returns the new info that was sent in parameters
- GET: obtains the info you were trying to read
- PUT: Updated resource by replacing it with data in parameters
- PATCH: Updates resources by modifying it with data in parameters
- DELETE: Indicates if request for deletion was successful.
What is the difference between an internal and an external API?
- Internal APIs is internal to a singular application: useful for using two different programming languages in the same application.
- External API works with publicly available data
What are the common API error codes?
- 100: in progress
- 200: ok
- 300: Redirect
- 400: Error with Request
- ## 500: Error with responsection
What are the most common types of APIs?
- REST
- SOAP
- AJAX
- Webhooks