The most direct way to interact with the QGIS application programming interface (API) is through the Python console, which can be opened by going to Plugins | Python Console. Alternatively, this can be done by clicking on the Python icon in the plugins toolbar. The Python Console is displayed within a new panel below the map, as demonstrated in the following screenshot:
The Python Console
The access point for interaction with the application, project, and data is the iface object. To get a list of all the functions available for iface, type help (iface).
This information is available online in the API documentation at http://qgis.org/api/classQgisInterface.html. Please also visit the dedicated Python API documentation at https://qgis.org/pyqgis/.