begin API post function