API(Application Programming Interface): API enables communication between two separate software systems. A software system implementing an API contains functions/sub-routines which can be executed by another software system.
Example: Now open UBER and see. Once the site is loaded, it gives you an ability to log in or continue with Facebook and Google. In this case, Google and Facebook are also exposing some level of users’ information. There is an agreement between UBER and Google/Facebook that has already happened. That’s the reason it is letting you sign up with Google/ Facebook.
How it actually works? Let’s see with another example:
User searches for local pizza options.
That search is sent to the app’s servers by API.
The app servers receives the API call, searches its database for pizza delivery options in the area.
The server puts together a response in JSON.
That response is sent by API.
The app takes this data and coverts it into a mobile friendly view.
UI(User Interface): UI allows the user to interact with the application.
UI testing refers to testing graphical user interfaces, such as how user interacts with the application, testing application elements like fonts, layouts, buttons, images, colors, etc. Basically, UI testing concentrates on the look-and-feel of an application.
For example, if you are testing an address book, the most likely scenario for a user would be adding in a new address. You could create a UI test that would navigate to the address book, click a button to add a new address, add the address, save it, and then search the address book to verify that it has been saved