Multiline Vars to Zapier to Airtable works, but how in KM with curl to Airtable

Hello,

i think in logseq and want to send the Text to Airtable. Here an Example of the Text.

  • Original Text: sfasdfasdfsa
  • Id: 5717D67B
  • Quote: Hier die steht die Quote
    • a
    • b
    • c
  • Headline: Hier steht die Headline
  • Headline2: Hier steht Headline2
  • Tags: Hier stehen die Tags
  • Twitter: Hier steht der Twitter Tweat
  • Polly: brauche ich das noch.
  • LinkedIn Headline: Hier die LinkedIn Headline
  • Lerneinheit:
  • Nummer: vom System zu vergeben

I put the whole Text in an KM-Variable and put it with cURL to Zapier with an KM Shellscript. In Zapier i call an RAW Hook, this works fine. Then it goes to Airtable.
Here the Script that works.

DATA=''$KMVAR_LogSeqMarkdown'';
/usr/bin/curl -v -H "Accept: application/json"
-H "Content-type: application/json"
-X POST
-d "$DATA"
https://hooks.zapier.com/hooks/catch/xxxxxxxx/;

But i didnt get with a direct cURL.

/usr/bin/curl -X POST https://api.airtable.com/v0/XYTable%201
-H "Authorization: Bearer XY"
-H "Content-Type: application/json"
--data '{
"records": [
{
"fields": {
"Notes": " '"$KMVAR_SMDB"' "
}
}
],
"typecast":true
}'

Then i got an Error.

{"error":{"type":"INVALID_REQUEST_BODY","message":"Could not parse request body"}

If put the Text in without a KM-Variable in this Format, it will work.
"Notes": "OriginalText: Holgers finest \nHallo 1 \nHallo 2 \nHallo 3 \nId: AAAAAAAA\nGedanken: Das wird gut \nQuote: Hier die steht die Quote \nHeadline: Hier st...",
"Blog": "laksjdfölaskjf \nalskfdjasldfkjs adf \nlkasjfsdfjk \n# Hallo \n## Heute \nBilder \n![vintage teal typewriter beside book](https://images.unsplash.com..."

My Question now: What can i do to bring multiline Code to Airtable?
Thanks for help

Different APIs handle data differently.

Since your "manual" submission works, where you've replace newlines with \n, have you tried doing the same with your KM variable? A simple


...may be enough (change variable name to suit, obviously).

1 Like

Thank you very much @Nige_S it helps.

I filter the Variable in the way you written, then i delete the " Sign in the Variable SMDB at the Front and End, with Regex and then i put it in the Shell script. Then it works.

I not fully understand the "" or ', i have to learn more, i was trying to avoid, to delete the " " in the Variable at the Front and End and reduce here the " "'"$DATA"'", but i didnt get it. Maybe to late in the Night.

Thank you very much.
Holger

DATA=''$KMVAR_SMDB'';

/usr/bin/curl -X POST https://api.airtable.com/v0/appYX%201
-H "Authorization: Bearer XY3"
-H "Content-Type: application/json"
--data '{
"records": [
{
"fields": {
"Notes": "'"$DATA"'"
}
}
],
"typecast":true
}'