Infosys interview question

Write an example code for API