I am working on an integration extension for Magento 2. I would like to create API endpoints for core_config_data
table, because I would like to insert a html script to header of each specific store view.
Let’s say that the Magento store has these records in core_config_data_table
:
+-----------+---------+----------+-----------------------+----------------------+
| config_id | scope | scope_id | path | value |
+-----------+---------+----------+-----------------------+----------------------+
| 47 | stores | 1 | design/head/includes | <link SOMETHING /> |
| 48 | stores | 3 | design/head/includes | <link SOMETHING /> |
+-----------+---------+----------+-----------------------+----------------------+
I would like to end up with something like this:
+-----------+---------+----------+-----------------------+----------------------------------------------------------+
| config_id | scope | scope_id | path | value |
+-----------+---------+----------+-----------------------+----------------------------------------------------------+
| 47 | stores | 1 | design/head/includes | <link SOMETHING /><script async="" src=URL-1></script> |
| 48 | stores | 3 | design/head/includes | <link SOMETHING /><script async="" src=URL-2></script> |
+-----------+---------+----------+-----------------------+----------------------------------------------------------+
I can figure out which value I want to include for which scope_id
(store view id), but I don’t know how to implement the endpoints that i need for this.
I think I need 2 endpoints:
- endpoint to fetch the current value in path
design/head/includes
for specificscope_id
- I need this because I want to extend the value, not replace it
- endpoint to update the value in path
design/head/includes
for specificscope_id
How should I go about solving this?