This topic is locked

Can 10.5 insert data to a table from an API View

3/7/2021 4:35:34 PM
PHPRunner General questions
S
stoneiii author

I have created a Rest API view that displays data when the user provides a filter on the view page. This is a great new feature for 10.5!

What is the recommended way to save that API view data to the database? In my application I would like to save data provided by the API view into my database. I am very familiar with how to do this with regular tables but not so familiar with the REST API views. I am using PHPRunner 10.5 build 36520 x64.
Thank you in advance for any help!

Sergey Kornilov admin 3/8/2021

When you pull data from the REST API all the same events will be executed so you can use BeforeRecordProcessed event to save data in another table.
We are also planning to add this as a feature to PHPRunner but there are too many questions to address i.e. how often to launch it, should we delete all existing data first or should we update the existing data in that table etc.

S
stoneiii author 3/9/2021

Thank you so much for this help! I was able to figure out how to get the data to write to another database table. I ended up using the AfterRecordProcessed event because the before was causing the table to render blank. Please let me know if you think this will cause some problems down the line. Thank you again!



When you pull data from the REST API all the same events will be executed so you can use BeforeRecordProcessed event to save data in another table.
We are also planning to add this as a feature to PHPRunner but there are too many questions to address i.e. how often to launch it, should we delete all existing data first or should we update the existing data in that table etc.

Sergey Kornilov admin 3/9/2021

Either event should work fine, you are good to go.