Adding objects from an external API to 2 Backendless tables with relations

Application ID 4A47197B-AE30-FA84-FF56-0071F4010900

I am able to successfully retrieve a list of objects from an external API that looks like this:

[
{
“date_updated”: “XXX”,
“display_name”: “XXX”,
“contacts”: [
{
“date_created”: “XXX”,
“emails”: [XXX]
}
]
},
{
“date_updated”: “YYY”,
“display_name”: “YYY”,
“contacts”: [
{
“date_created”: “YYY”,
“emails”:
}
]
}
]

I now want to add objects to 2 tables in Backendless. The parents table should contain objects with the date_updated and display_name properties while the student table should contain objects for date_created and emails. There should be a 1-1 relation from student to parent objects.

I first tried adding the parent objects to the table with this logic:

I got 126 out of 360 objects into my table.
image

I then received this error message:
{
“code”: 0,
“message”: “Task execution is aborted due to timeout”
}

Am I doing it right? I want to get 360 objects into the table, then get the students into the student table and then create relations following your logic on this video.

Hi, @Andreas_Marinopoulos

This error occurs due to a big number of objects which you are trying to save. In this case we can offer you to use bulk create component https://monosnap.com/direct/fjuNaysn0Xbyr1IOaoejLUs06aoyWj instead of loop.
Or, as one more way you can buy additional Code Execution Time in the marketplace, in order to avoid time limit error.
https://monosnap.com/direct/ye75HMn8Veczhdasc6Z8pOb3bJRube

Regards,
Marina

Thanks! To use bulk create, I guess it is best to add all the objects to a list first? I will try this.

Adding all objects to the list increases the execution time, this can lead to the error you get.

Regards,
Marina