This is the typical order of operations for a simple API application:
Create and initialize an ESB_INIT_T structure.
Initialize the API by calling EsbInit().
Log in to the required server by calling EsbLogin() or EsbAutoLogin().
Select an active application and database by calling EsbSetActive() or EsbAutoLogin().
Retrieve (or lock) data by calling EsbReport() or related functions.
Update data by calling EsbUpdate() or related functions.
Recalculate the database by calling EsbCalc() or related functions.
Produce reports against the data by calling EsbReport() or related functions.
Log out from the server by calling EsbLogout().
Terminate the API by calling EsbTerm().