Page 1 of 1

Add multiple items to database

Posted: Thu Dec 27, 2012 5:31 am
by damien

My app gets API response from facebook that returns multiple posts from logged in user. how can I save all posts displayed on results page to tiggzi database?

Example response:

user id123 post1
user id123 post2
user id123 post3

I need to save all posts to database. There can be a different amount of responses each request.


Add multiple items to database

Posted: Thu Dec 27, 2012 10:18 am
by Kateryna Grynko

Hello,

Standard Tiggzi tools do not provide this, so you can write JavaScript code to do it.
We will search for the easiest solution.


Add multiple items to database

Posted: Fri Dec 28, 2012 12:53 am
by Agon Bina

I'd be interested to hear what's the best solution for this too. I am going to need this feature soon.

thanks!


Add multiple items to database

Posted: Fri Dec 28, 2012 11:30 am
by Kateryna Grynko

Hi,

To add multiple items to database you have to run Rest Service that adds item to DB several times.

Create a mapping in Rest Service from localStorage variables to Request parameters:
Image

Then run following JavaScript code to add item to DB:code
localStorage.setItem('phone', '555-11-99');
localStorage.setItem('completed', 'true');
createRequest.execute({});/code
("createRequest" is a Rest Service name on Data tab)

This JS code must be run in the cycle for each Facebook post.
And database queries will be executed in parallel (asynchronously).