API Basics Flashcards

1
Q

What is an API?

A
  • An interface to some data on a server, typically stored in a database
  • Think of it like a bridge that links the client to a backend server
  • Interface allows program to communicate and exchange information to that server. Without it, the server would be unable to communicate with outside world.
  • APIs are typically web-APIs, which work over the internet.
  • i.e. A weather app on your phone talks to an API to get latest weather forecast.

https://www.geeksforgeeks.org/what-is-an-api/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does Postman come in handy for using an API?

A
  • APIs are designed to be used from programs by writing code to access that API.
  • APIs do not have a friendly interface to view them.
  • Postman connects to a server through an API and exchange data
  • Allows you to work with APIs throughPostman interface (does not require excess code or work)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does an API stand for?

A

Application Programming Interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the term interface mean in an API?

A
  • Interface is a contract - defines set of rules that must be followed in order for two entities to communicate/interact with one another.
  • API contains set of rules and protocols for how one system can access and use data provided by another system.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a web API?

A
  • A set of rules and protocols that define how two systems can communicate iwth each other over the internet.
  • Web APIs are typically accessed over HTTP or HTTPs, and use a variety of data formats, including JSON or XML to exchange information.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe the process of how an API works from the client perspective:

A
  1. Client initiates request via the API’s Uniform Resource Identifier (URI)
  2. API makes a call to the server after receiving the API request
  3. Server sends the response back to the API with the requested information
  4. API transfers the data to the client
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an API architecture, and what are some of the main kinds?

A
  • API architecture is the blueprint/design for determining how an API is structured. Some common types are:
    1. REST: For lightweight, scalable APIs
    2. SOAP: Stricter protocol for more secure APIs
    3. GraphQL: Query language for APIs
    4. AsyncAPI: Used for Asynchronous APIs
    5. Remote Procedure Call (RPC): Protocol for invoking processes, written in XML or JSON
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe what a Rest API is.

https://cloud.google.com/blog/products/application-development/rest-vs-rpc-what-problems-are-you-trying-to-solve-with-your-apis
https://www.reddit.com/r/explainlikeimfive/comments/rypnmj/eli5_what_is_a_rest_api/?rdt=40188#:~:text=In%20a%20REST%20API%20a%20piece%20of%20software

A

REpresentational State Transfer
* A kind of API architecture that uses stateless interaction.
* REST treats data as resources that can be acted on using standard HTTP methods (GET, POST, PUT, DELETE). Instead of focusing on actions like an RPC would do (i.e. “getUser”, “createUser”), REST focuses on manipulating resources directly.
* In REST APIs, resources are identified using URLs. Those resources can be altered by performing HTTP requests (i.e. SENDing a request) to those URLs
* This differs from RPC, which focuses on explicit commands/actions.
* REST APIs allow for standardized way of interacting with different types of data.
* Stateless: Each API call must contain all information needed to be understood by the server, because REST API calls have no prior knowledge of previous API calls. (there is no coupling of API calls)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Remote Procedure Call (RPC)?

https://www.reddit.com/r/explainlikeimfive/comments/17ey3qe/eli5_remote_procedure_calls_rpc_and_whywhen_is_it/#:~:text=An%20RPC%20is%20like%20your%20boss%20calling%20you

A
  • An API request to a remote server asking it to do something for you
  • The “Procedure Call” is just the request for that remote server to run a specific call/function for you.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is CRUD? How does it relate to a Rest API?

A
  • Acronym referring to the 4 major ways you interact with database applications:** Create, Read, Update, and Delete**
  • CRUD represents the basic operations of a Rest API.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between HTTP and HTTPs?

A

HTTPS Uses an encrypted connection to secure the transmission of data, while HTTP does not.
* In Postman, the http:// specifies whether it is HTTP or HTTPS, but note that an API call and it’s response will appear the same in Postman besides this.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an HTTP request typically composed of?

A
  • Request Line: Specifies HTTP method, URL, and HTTP version (i.e. GET /index.html HTTP/1.1)
  • Headers: Key-value pairs providing metadata about the request (i.e. Host: www.example.com User-Agent: Mozilla/5.0 Accept: text/html)
  • Body (optional): Contains data sent to the server (used in POST, PUT HTTP methods) (i.e. { "username": "example_user", "password": "example_password" })
  • Query Parameters (optional): Data appended to the URL for filtering or refining the request. (i.e. /search?query=example&page=2)
  • Cookies (optional): Small pieces of data sent from the browser to maintain session or user info (i.e. Cookie: sessionId=abcd1234; rememberMe=true)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly