Mapping raw data to formatted table - JSON API

Hello!
Been losing my mind for the past day trying to figure this out and can’t seem to find the solution.
One of our partners who hosts inventory for us gives us access to our Inventory on Hand through their Inventory API. The response from the API is unformatted and comes back as a string of data with no headers (although it does have headers).
I’m trying to have the Inventory directly feed into my app which has a POST Row API. In an ideal world, whenever our inventory goes up, down, or gets new units, my app’s table updates itself.

Tried a bunch of functions and options in N8N but none seem to work.

Attached are my screenshots. As you can see, I am able to retrieve the raw data from the Inventory API and am able to Post on my table but whenever I post (last screenshot) all I get repeated header values without the actual data populating.

Is there a way to map for example “sku_code” from Inventory API to “sku_code” in my app’s table?

Current Process:

Response from Inventory API

Result when running POST

Result in my app’s table:

Welcome to the community @Biscottino

What is the output of the function node?

Can you share an example (with dummy data) of the output of the first HTTP node?

Can you share an example of the HTTP request you need to do in order to insert a row?

Ciao @RicardoE105 !
Thank you. Excited to be here. Was working with Integromat and Zapier but am fascinated with the potential of n8n.
The Function I have in there is a disaster. Shouldn’t have even included it in the screenshot. I believe it’s the tool in between the two HTTP that I need but am not certain of it.
The following is an example of the output of the first HTTP node with the italics being the headers I normally have in a CSV which I export from the Inventory and the Blue text being the values that are attributed:
sku_code,sku_name,batch_code,sku_unit,sku_price_per_unit,batch_expiration_date,skubatch_last_updated_date,batch_manufacturing_date,batch_license_number,sku_inventory_type,sku_inventory_class,sku_inventory_category,batch_D_percentage,batch_T_percentage,batch_other_DD_percentage,batch_TT_percentage,batch_T_weight,batch_D_weight,batch_other_TT_weight,batch_D_weight,batch_A,total_count,total_incoming,total_outgoing,total_available,skubatch_days_at_distrus,sku_is_sample,sku_type,ok_pre_12_11_20_al_incoming,ok_pre_12_11_20_nl_outgoing,ok_pre_12_11_20_nl_available,ok_pre_12_11_20_nl_counted,l_legacy_sl_incoming,l_legacy_sl_outgoing,la_legacy_sl_available,l_legacy_sl_counted,ok_incoming,ok_outgoing,ok_available,ok_counted,l_incoming,l_outgoing,la_available,la_counted,la_commerce_incoming,la_commerce_outgoing,la_commerce_available,la_commerce_counted,is_quarantined_in_OK_Pre_12_11_20_Nl,is_quarantined_in_L_Legacy_Sl,is_quarantined_in_OK,is_quarantined_in_L,is_quarantined_in_L_Commerce T-SU-S, Tudi 1g BrownSugar - SAT - CSS,TS-020222-COS-1G,1g,10,02/02/2025,02/10/2022,02/02/2022,C11-0001216-LC,0.08%,80.05%,90.65%,0,0,0,0,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,N,N,N,N,N
And this is the POST request to add rows to my app’s system:
curl --request POST ‘https://api.glideapp.io/api/function/mutateTables
–header ‘Content-Type: application/json’
–header ‘Authorization: Bearer a33f085c-c783-3dada-a7ee-c04e5b9ab162’
–data-raw ‘{
“appID”: “Edqt0pBTVUQhRdRBCqTI”,
“mutations”: [
{
“kind”: “add-row-to-table”,
“tableName”: “native-table-CutiPv98qbPFB8LVQMGU”,
“columnValues”: {
“Name”: “sku_code”,
“Date”: “sku_name”,
“Description”: “batch_code”,
“GMV”: “sku_unit”,
“Owner”: “sku_price_per_unit”,
“batch_expiration_date”: “batch_expiration_date”,
“skubatch_last_updated_date”: “skubatch_last_updated_date”,
“batch_manufacturing_date”: “batch_manufacturing_date”
}
}
]
}’

Appreciate all the help. Truly lost at this point.

Ok, why is the first HTTP request did you set the response format to string, instead of JSON or file? Having the data as a JSON or file it’s going to make it much easier to work with. The problem is that the data of the first node is not properly formatted so that it can be used in the last HTTP node using expressions.

Ciao Ricardo,

The issue is that the Distributor’s API sends out string - it comes as a CSV basically.
This is the error I get if I change the Response Format to JSON: ERROR: Response body is not valid JSON. Change “Response Format” to "String"

Is there a way to put a filter in between that would change the String to JSON?

Ahh gotcha. Then you are going to need to map that CSV string to a JSON. For that, you are going to need probably a function node.

Yeah it’s what I figured. Just can’t figure out how to write the code

Just figured that you can do it without a function node. Check the example below

Ciao Ricardo,

Appreciate you taking a look at this. Question though: if not being added in a function module, where is this code being added? I’m still new to n8n so i’m a bit lost

Just copy the whole JSON and paste it into a new workflow. That way, you are going to be able to run the example.