In a recent interview, I was asked, do you know the concept of idempotency in APIs.
I had read it once but I couldn't recall it, felt dumb a bit, so I went back and I read all I can about it.
So here's an example, if the API's were not idempotent would have happened,
Let's say I want to buy a flight ticket from Ahmedabad to Delhi for 3000 INR. I am paying via my Paytm wallet having 10K balance.
I pressed the pay button but nothing happened so after a few seconds I again tried it and it was successful.
After a minute, I got 2 notifications saying we have booked your flight from Ahmedabad to Delhi and your current balance is 4000 INR, and with that follows a mild heart attack, and a loss of 3000 INR, and what if I was booking a flight from Ahmedabad to USA, ðĩðŠĶdead...(account balance).
But in real life, APIs are idempotent.
Meaning, when you press pay once, it stores your request, when you again retry it, it goes and checks, is it the same request??? If yes, it doesn't process it again and voilaa the payment is only done once.
#interview #api #idempotent #learningandgrowing
I had read it once but I couldn't recall it, felt dumb a bit, so I went back and I read all I can about it.
So here's an example, if the API's were not idempotent would have happened,
Let's say I want to buy a flight ticket from Ahmedabad to Delhi for 3000 INR. I am paying via my Paytm wallet having 10K balance.
I pressed the pay button but nothing happened so after a few seconds I again tried it and it was successful.
After a minute, I got 2 notifications saying we have booked your flight from Ahmedabad to Delhi and your current balance is 4000 INR, and with that follows a mild heart attack, and a loss of 3000 INR, and what if I was booking a flight from Ahmedabad to USA, ðĩðŠĶdead...(account balance).
But in real life, APIs are idempotent.
Meaning, when you press pay once, it stores your request, when you again retry it, it goes and checks, is it the same request??? If yes, it doesn't process it again and voilaa the payment is only done once.
#interview #api #idempotent #learningandgrowing
ð2
Cisco is hiring Software Development Engineer
Role: SDE
Location: Bangalore
Qualification: BE/BTech/ME/MTech/MCA
Passout year: 2022 Batch
Salary: 10lpa - 14 lpa
Apply Now: https://jobs.cisco.com/jobs/ProjectDetail/Software-Engineer-Internal-Applications-New-Grad-India-UHR/1337682
Role: SDE
Location: Bangalore
Qualification: BE/BTech/ME/MTech/MCA
Passout year: 2022 Batch
Salary: 10lpa - 14 lpa
Apply Now: https://jobs.cisco.com/jobs/ProjectDetail/Software-Engineer-Internal-Applications-New-Grad-India-UHR/1337682
ð1
Because this keyword does not means instance var it's behaving like a local instance
When we get noSuchMethodError:main exception
Anonymous Poll
57%
After compilation
43%
Before compilation
Which exception is noSuchMethodError:main
Anonymous Poll
63%
Runtime exception
37%
Compile time error