Add function for sending data to API with POST