• 0
KAXMI

(REST) Insert multiple records at once

Question

Hi,

Greeting, I am new to this forum, I am having a problem when inserting multiple records at once by REST. It works perfect while inserting single record each time.

However, it takes more than 3 mins when inserting about 300 records, does anyone know how to make a bulk insert instead of looping it. I have tried the following, but it doesn't work.

[{"ID":"1","Date":"11/29/2016"},{"ID":"2","Date":"11/30/2016"} ]

{"ID":"1","Date":"11/29/2016"},{"ID":"2","Date":"11/30/2016"}

Share this post


Link to post
Share on other sites

2 answers to this question

  • 0
On 10/24/2016 at 10:45 AM, KAXMI said:

Hi,

Greeting, I am new to this forum, I am having a problem when inserting multiple records at once by REST. It works perfect while inserting single record each time.

However, it takes more than 3 mins when inserting about 300 records, does anyone know how to make a bulk insert instead of looping it. I have tried the following, but it doesn't work.

[{"ID":"1","Date":"11/29/2016"},{"ID":"2","Date":"11/30/2016"} ]

{"ID":"1","Date":"11/29/2016"},{"ID":"2","Date":"11/30/2016"}

Hi Kaxmi,

It's a limitation of caspio REST API. Inserting multiply records is not allowed.

Share this post


Link to post
Share on other sites
  • 0

I know this is an old post but I faced this issue a couple of weeks ago. First, you should do API request through PHP since if you do it through AJAX or JavaScript you are exposing  to the all users that reach your app your credentials and anyone with basic/intermediate knowledge can do pretty much anything they want with your DB if permissions are not set properly.

I tackled this by looping in PHP and then sending only the data through AJAX but as you mentioned, it may take some time, plus you need to create a queue for 300 records as you dont know if a record may fail so you need to handle all this. Hard to accomplish but you can get a good PHP developer to do this or Caspio Prefessional Development can do anything you can imagine too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now