Skip to content

How to save data into table that pull from an API in Magento 2.4.4?

i have a problem how can i save the data that I pull form an API on website
Here is my website I wanna get data from API: https://blog.api.rakuten.net/api-tutorial-rakuten-marketplace-api/

I really do not know how to do it and I need help.
I’ve created 2 db_schema just to save data that pull from API:

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">

<!-- This table to save data from API popular item-->
<table name="popular_item" resource="default" engine="innodb" comment="Popular Product Table">
        <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
    </table>

<!-- This table to save data from API search item-->
<table name="search_item" resource="default" engine="innodb" comment="Search Product Table">
        <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
    </table>
</schema>