Help

Re: Syntax Error wordai

3607 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Marc_Justin_Rai
6 - Interface Innovator
6 - Interface Innovator

Hello, i got this error but i don’t have any idea where to look for to fix this issue

1. Error {name: "SyntaxError"}

  1. name: "SyntaxError"

Here is the code :

const wordAI = await remoteFetchAsync("https://github.com/braytonstafford/wordai", 
{
  method : "POST",
  header : {
     'Content-type' : "application/json"
  },
  email: email,
  key: wakey,
  input : "This is a test",
  rewrite_num: 2,
  uniqueness : 3,
  output: 'json',
  quality: 'Regular',
});
   try {
       const data = await wordAI.json()
       console.log('response data?', data)
     } catch(error) {
       console.log('Error happened here!')
       console.error(error)
     }
19 Replies 19

Hello, I’m new in airtable, may i have an example how to add the header in the header? I only know how to do this one whenever i have to use the await fetch or remotefetchasync.

Hi, This is the example they provide.

curl -d "email="+email+"&key="+wakey+"&input=This is a test.&rewrite_num=2&uniqueness=3&return_rewrites=true" -X POST http://localhost:4050/api/rewrite

Hello, i tried and test the Content-type:application/json;charset=utf-8 I only tested this kind of method as i don’t know how to add the message header if i’m going to use the table.selectRecordAsync as my primary.

It still shows the “Alès”.
Thank you for the assistance.

const url = "https://api.airtable.com/v0/appV1begTvublATlv/tblR5JePA9pLYP1YQ?api_key="+MY_API_KEY; //population

    const headers = {

        "Content-type": 'application/json;charset=utf-8',

        'method' : 'GET'

    }

This suggests their example assumes the web service has been downloaded and is running on your own computer. have you done that?

Unfortunately, this has nothing to do with Airtable. The questions you are asking are wholly about integration architectures that separate and apart from making Airtable solutions. This is the realm of integration and it requires some degree of experience with APIs and HTTP(s); code that you can get wrong about a hundred different ways and code that you can get right only a few ways.

I suggest you find a consultant in the community who is willing to work with you to solve this challenge.

But, isn’t that the accurate data in the table? If not this, what would you expect?

I’m expecting to remove the accent character and the output will be Ales.

That’s not what UTF-8 encoding is designed to do. It’s the opposite; it sustains the proper exchange of values between unlike OSes and other systems.

You need diacritics transformation using RegEx -

const str = "Crème Brulée"
  str.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
> "Creme Brulee"

Thank you, i have to insert all the accent letters inside the regex then.

I haven’t tried this as i’m doing the test on airtable script.