apiCall now takes data and type, and switches between payload and formData