Tutorial and codes for API demo