Help

Re: Syntax Error wordai

3710 18
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

I’ll bet this is not the endpoint for the API.

Yes sorry i fetch the correct github api link. Here it is:

But i get this error after.

Error: Response status was 301 ‘Moved Permanently’ but redirect mode was set to ‘error’

Here is my new code, I checked first if i can connect the github properly

let url2 = "https://github.com/braytonstafford/wordai.git";
const headers2 = {
        'Content-Type': 'application/json',
        'method' : 'GET'
    }
const wordAI = await remoteFetchAsync(url2, headers2);
   try {
       const data = await wordAI.json()
       console.log('response data?', data)
     } catch(error) {
       console.log('Error happened here!')
       console.error(error)
     }

GitHub pages are not API endpoints. You need to sign up for an account at WordAI, login, locate the documentation that tells you what API endpoint to use for requests.

Yes, but the WordAPI documentation only has the example for curl fetch, i don’t know any alternative code that is related to JSON for curl. i only found this github.

I assume you have an account and you are paying $57/month for the service.

Go to this URL and look for the getting started section and note the API endpoint. That’s the only way to utilize this API. Sending WordAPI requests to GitHub will not magically provide free access to their paid service.

Yes, I’ve taken a look on the wordai documentation on API. As i don’t have clue how to manage the API endpoint requests on JSON as they provided an example of using curl method only.

@Bill.French May i add a new question here, Is there a way to convert the record to utf-8?

As my records contains some of this text “Alès”

Please publish that example so we can see it.

Yes. Include Content-type: application/json; charset=utf-8 in the message header.