Text Analysis

חינם
על ידי Bhavya Gaur | מְעוּדכָּן il y a 4 jours | Text Analysis
פּוֹפּוּלָרִיוּת

9.8 / 10

חֶבִיוֹן

380ms

רמת שירות

100%

Health Check

N/A

חזרה לכל הדיונים

Axios endpoint not working?

Rapid account: Dreamreal F Qa Fytryf 0

I was trying to use the sample code as shown on the article extraction, and while the test endpoint works, I cannot get the endpoint to work locally at all.

I get:

**{
time_taken: 0.0007228851318359375,
msg: ‘validation error, incorrect data passed to the server’,
ok: false
}
**

Again, I’m using the sample code as shown, literally, with Node.js and Axios.

Rapid account: Gaurmanojkumar 530
gaurmanojkumar530 Commented il y a 2 ans

I am glad to know dreamreal@gmail.com that your issue has been solved. To everyone else please post only working and complete solutions.

Rapid account: Dreamreal F Qa Fytryf 0
dreamreal-FQaFytryf0 Commented il y a 2 ans

Okay, thank you - you’re right, using a different approach worked through the issues. The code I used, BTW, looked like this, as generated verbatim by Postman but with data replaced with gibberish:

var axios = require('axios')
var FormData = require('form-data')
var data = new FormData()
data.append('language', 'english')
data.append('url', 'https://jlhagsdljghaskjhaksjdhgasd')

var config = {
  method: 'post',
  url: 'https://text-analysis12.p.rapidapi.com/article-extraction/api/v1.3',
  headers: {
    'X-RapidAPI-Host': 'text-analysis12.p.rapidapi.com',
    'X-RapidAPI-Key': 'lkjsldkjhalskdlakshdlakjhsdlkjahsd',
    ...data.getHeaders()
  },
  data: data
}

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })

This code can be (and will be) optimized, but it works better than the sample code offered through RapidAPI.

Rapid account: Gaurmanojkumar 530
gaurmanojkumar530 Commented il y a 2 ans

The test code is auto-generated by RapidAPI. It is not correct always for all languages and frameworks. You can try postman’s auto code generation it does a better job sometimes. When you get “validation error” with 200 status code it means that everything works correctly on our end. Your client side code has not been formatted correctly.

הצטרף לדיון - הוסף תגובה למטה:

התחבר / הירשם כדי לפרסם תגובות חדשות