Interfax api data processing
Get xml string, return xml string
filters param in api request methods is postprocessed with fast-xml-parser xml data like:
Example:
<filters>
<official>false</official>
<codes>
<code>US0378331005</code>
<code>US0378331004</code>
</codes>
<dateFrom>2022-03-30</dateFrom>
<dateTo>2022-03-30</dateTo>
<fields>
<field>MPRICE</field>
<field>LCLOSE</field>
<field>DISCOUNT</field>
</fields>
</filters>
Also you can use a package data:
Package example:
<filters-list>
<filters tag="one random tag with his name and value will be presented in response xml">
<issId>782490</issId>
<date>2022-05-25</date>
<dateType>ACTUAL</dateType>
<official>false</official>
<fields>
<field>id_iss</field>
<field>TIME</field>
<field>LAST</field>
<field>VOL_ACC</field>
<field>DEAL_ACC</field>
</fields>
</filters>
<filters>
<issId>782483</issId>
<date>2022-05-25</date>
<dateType>ACTUAL</dateType>
<official>false</official>
<fields>
<field>id_iss</field>
<field>TIME</field>
<field>LAST</field>
<field>VOL_ACC</field>
<field>DEAL_ACC</field>
</fields>
</filters>
</filters-list>
Each api route use his own request xml depending on required params.
Steps:
- Read xml from database and convert it to js object via fast-xml-parser or other library
- Request data with this params from api[methodName]
- Return xml data