Update/Create DB table from a Rest API JSON response

Hi,

I get this response from my rest call:

{
  "entities": [
    {
      "entity_type": "AssetList_c",
      "properties": {
        "LastUpdateTime": 1662726104868,
        "**Id**": "16909",
        "**DisplayLabel**": "Car"
      },
      "related_properties": {}
    },
    {
      "entity_type": "AssetList_c",
      "properties": {
        "LastUpdateTime": 1662726124614,
        "**Id**": "16910",
        "**DisplayLabel**": "Room"
      },
      "related_properties": {}
    }
  ],
  "meta": {
    "completion_status": "OK",
    "total_count": 2,
    "errorDetailsList": [],
    "errorDetailsMetaList": [],
    "query_time": 1663791395524482
  }
}

And I need to put the values from Id and DisplayLabel into my table in my DB.
The data should be mapped like this:
JSON <-> DB
Id <-> Id
DisplayLabel <-> filter

I've been googling and searching this forum but I still can't figure this out :sweat_smile:

Hi @Zem!

Have you considered adding a Transformer to your rest query that transforms the data in the shape you need? For example:

return data.entities.map(obj => {
  return {
    id: obj.properties['**Id**'],
    displayLabel: obj.properties['**DisplayLabel**'],
    properties: _.omit(obj.properties, ['**Id**', '**DisplayLabel**']),
    related_properties: obj.related_properties
  }
})