REST API Interview Questions (Advanced Level)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're gonna dive deep into rest apis and talk about eight advanced interview questions my name is kevin way i'm a product manager and i'm here to help you land your dream job in tech [Music] understanding rest apis is crucial to getting your dream software engineering job in our last video we talked about nine common rest api interview questions and answers today we're going to dive deep and cover eight more advanced questions and answers so let's get started question one what's the difference between put post and patch put and post are very common http methods the key difference is that put is used to update a specified existing resource while post is used to create a new resource there's also the method patch which is another way of updating a particular resource the difference between put and patch is that patch alters only the data that is specified whereas put replaces the entire resource with a new resource comprised of the given data before we jump into the next question if you enjoyed these tech interview videos be sure to like subscribe and hit the notification bell for new videos every single week this really helps with the algorithm and we put a lot of effort into these videos with the goal of helping as many people as possible so your like or comment is really helpful to show your support on a question number two what is a payload in the context of a rest api payload refers to any data that has been transferred via request or response through the rest api for instance if the client makes a get request the server will provide a response with a payload or the client may provide the payload like any post request where the client is giving the data to the server question three what is a rest message the concept of messaging refers to the back and forth communication via request and response by the client and server there's typically a message within every response body associated with the provided status code this message is one of the most important parts of debugging and testing a rest api examples of a message include confirmation of resource was created or that any exceptions were raised question four what are the core components of an http request there are five components in an http request method uri http version request header and request body first the method this may also be called the verb this refers to operations like get post put delete etc uri this is used to identify the resource typically using a url http version this indicates the http version that is being used typically http 1.1 or http 2.0 request header this contains the metadata which can be the message format cache settings content format etc and request body this contains the content or data that's being sent question five what are the core components of an http response there are four components in an http response status code http version response header and response body the status code provides information about the success or failure of a request 200 codes indicate success 400 codes indicate a client-side error and 500 indicates a server-side error the http version indicates the version that's being used the response header contains response metadata like content length content type date etc and the response body which contains the return data while there doesn't always have to be a response body in a request a response should always contain a response body question 6 what is an itempotent method and why are they important when using restful web services a client may make numerous requests to a server at a time an idempotent method is one that yields the same response regardless of how many times a request is sent for example imagine pressing a button on a webpage that makes a get request to a resource after the nth press of a button the api response will still be the same as the first press rest apis are designed on the principle that the client should not depend upon previous api calls hence why the rest architecture is made to be stateless therefore rest apis should be made such that their methods are idempotent when possible question seven what's the difference between item potent and safe http methods an idempotent method is one that can be called multiple times without changing responses while a safe method is one that does not change a resource meaning it may read but not right for example a get method is considered to be safe question 8 explain caching in a restful architecture a client may request the same data from a rest api many times in this case it's beneficial for the response to be cached this way less bandwidth is needed and the client may retrieve data faster each rest api contains specific metadata related to the caching of responses for example the headers of cache control and expires specify what responses may be cached by whom and for how long now before we wrap up this video let's talk a bit about best practices in developing a restful web service when building you're going to want to consider a few things to make your system even stronger these include supporting json data transfer using proper status codes using uri hierarchy to represent the relationship of resources using itempotent http methods using caching and incorporating security measures rest apis can be easy to use and are powerful especially when used properly i hope this video helped paint a deeper picture about rest apis and for more tech interview prep content exponent has the best resources to help you laser interview including in-depth interview courses private coaching and a community of experts ready to help you prep for even the toughest questions go to try exponent dot com to become a member today thanks for watching [Music]
Info
Channel: Exponent
Views: 59,728
Rating: undefined out of 5
Keywords: yt:cc=on
Id: n2JQFFFEd0M
Channel Id: undefined
Length: 6min 18sec (378 seconds)
Published: Mon Sep 26 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.