Updated api submit data function