How to create a dataset in a loop?


#1

I want to create a dataset of appointments from an instance variable @appointments. I have this code, but it does not work. My dataset only has one of the ten appointments in it. How can I modify this?
@appointments = Appointment.order(created_at: :asc).last(10)
@appointments.each do |appt|
dataset.put([
{
amount: appt.base_amount/100,
timestamp: appt.start_at
}
])
end


#2

Hi @mmiller you should be able to achieve that by using POST instead of PUT on your code. Our API uses POST to append data to your dataset whilst PUT is used to replace data


#3

2 posts were split to a new topic: Request body size error