Hello there! I'm a business analyst and here I want to tell you about API from my prespective. I'm pretty sure you would have heard the term API, and if you were wondering what it is, then this is the article for you.
Understanding the technology concepts is a huge plus for a business analyst role and gives you an edge during the hiring process. This article will cover from a non-technical perspective for an easy understanding of what an API is.
Let's see the example: The meat restaurant owner called MeatCoin s is looking for an online home delivery service for her restaurant. He wants their customers to create, view, update, or delete their home delivery orders. He also wants these functionalities to be performed by their customers either using the restaurant's website or the mobile app. In addition, he wants the same functionalities to be available for the customers using a partner or aggregator applications and websites.
Sounds complex? Let us see how this difficult requirement becomes simplified, and consistent behavior is exhibited across all platforms: restaurants website, mobile application or partner or aggregated websites, or applications using the APIs.
Stay tuned: API is an acronym for Application Programming Interface.
Let us take a simple example to understand what an API is: you are planning to watch a movie next week, and you prefer BestMovie cinemas as you like their seats and service. You log on to BestMovie website for online booking of the tickets, you select the date and the movie by using the website's user interface or UI. Once you have entered the required details, you click on submit button, and the show timings matching your search criteria would be displayed on the screen for your selection. You are interacting with the BestMovie cinemas application using the screen, which is the user interface.
But let us say someone is very keen on watching the movie and they don't have a preferred cinema, and they are just looking for the nearest option. They would use a movie ticket booking aggregator website and search for the details. The aggregator website is an application that will interact with the individual cinema applications BestMovie cinema's will be one of the applications with which the aggregator website will interact to get all the details.
The aggregator website uses an application programming interface or an API to communicate with the BestMovie cinema's application. The requested show timings and other information would be returned to an aggregator application that matches the search criteria. In simple terms, API is used for communication between two applications. That's about it.
Okay, let's get back to our example: the requirements for MeatCoin home delivery service are to enable customers to create, view, update and delete their home delivery order for multiple platforms. Let us create one API for each function. Let's start with "Create order", there are three key components of an API:
Let's start with the input part: for order creation at a minimum, we would need the customer details that is their name and address of deliverance, order details such as food items which they want to be delivered, and payment mode that is whether the customer has already paid for the order or is it cash on delivery.
For the second part of the API, we can validate the input and processing logic details that auto-generate the order number and store the order details in a database.
For the third part, the output, this API can send the generated order number back to the calling application for reference with the indication of successful order creation. If there is a validation failure or any processing error, an error message should be sent back to the calling application indicating an error.
This is a simple, non-technical view of a create API. If any application passes the required inputs, this API will create an order and provide the order details back to the calling application. On the back-end, it would use the post HTTPS method. I won't go into the technical details, you can search further for POST method for further information.
Okay, now let's move on to our following functionality, which is "viewing the order details". Once the order has been created customer may like to view the order details let's create another API for viewing the customer details. As discussed earlier, as part of creating API, this API would also have three key components: inputs processing logic and the output.
Let's start with the input part for the order details retrieval: we would need the order number at a minimum.
For the second part of the API that's the processing unit, it will read the order database with the order number provided as a part of the input. If the read is successful, then the order details are returned if the order number is not found, then an error message would be returned.
For the third part, the output, his API would return the order details to the calling application. If the order details are not found for the provided order number, an error message would be sent back to the calling application indicating an error. If any application passes the required input, this API will fetch the order details from the database and provide the order details back to the calling application.
Now let's move on to our next functionality, which is "updating the order details": once the order has been created, customers may like to change their order details or update their delivery address. If the update is within the permissible time, like 3 hours before delivery, it would be allowed. Else an error message should be thrown.
The input part for order update: at a minimum, we would need the order number and the revised order details or the updated address for delivery.
For the second part of the API, that's the processing part, before updating the order in the database, there would be validation that is, if the time is greater than three hours of the delivery time, then the order details will be updated in the order database, and the updated order details will be prepared and delivered. If the time is within three hours, then an error message will be returned.
For the third part, output, this API would return the successfully updated details back to the calling application. If it is not within the permissible time limit, an error message should be sent back to the calling application indicating an error.
Okay, now let's move on to our last functionality, which is "cancellation of the order".
The customer may like to cancel their order if the cancellation is within the permissible time, like three hours before delivery, then it would be allowed else an error message should be thrown. Let's create an API for cancellation.
Start with the input part for order cancellation. At a minimum, we would need the order number for cancellation.
The second part of the API, that's the processing part, before cancellation of the order in the database, would be validation that if the time of cancellation is greater than three hours of delivery time, the order would be marked as canceled in the order database. If it is within three hours, an error message would be returned informing that it is impossible to cancel the order.
In the third part, the output, this API would return the successful cancellation message to the calling application if it is not within the permissible time limit. An error message would be sent back to the calling application indicating an error.
Now we have developed four APIs for create, update, view, and delete of the order.
Let's go back to our example: the requirements from the owner of the MeatCoin restaurant was to have the home delivery options from multiple platforms that is from their website, mobile application, aggregator, or their partner website. This is where the magic of APIs plays out. All these applications can invoke the above developed APIs by passing the required input.
For example: the customer can log on to MeatCoin's restaurant website to create an order, which will invoke the create order API, the customer then, on the go, gets a phone call, and they want to add one more item for dinner as they are expecting one more guest.
They can log on to their mobile application to view the order, which uses read API, and can update the order using update API. Similarly, if some other customer accessing the aggregator website for meat food and finds the MeatCoin, they can also order using the same APIs that is the power of the APIs, and that is why it is so much used and sought out.
The restaurant wants to provide more flexibility to the customers, and they want to reduce the update limit to 2 hours from 3 hours, the changes are required only in the update API logic, and once that is redeployed, everything will work seamlessly.
Hopefully, I was able to provide an overview of what an API is and how the API works, and how it can be used in multiple platforms. Again, I have not gone into technical details intentionally as I wanted to keep it simple for easy understanding. Have a good day!)
Create your free account to unlock your custom reading experience.