Hello,
the method for translating the text always returns error 502 bad gatewey in the React app, while if I try it from Postman it returns the translated text correctly.
Can anyone help me?
Thank you
Maico
Participez à la discussion - ajoutez un commentaire ci-dessous:
messages:"The API is unreachable, please contact the API provider"
info:“Your Client (working) —> Gateway (working) —> API (not working)”
same problem anyone solution
Try so many methods but always get the below error.
{
“messages”: “The API is unreachable, please contact the API provider”,
“info”: “Your Client (working) —> Gateway (working) —> API (not working)”
}
Hello can someone please help. I tried using the api call with javascript fetch but i get the 502 (Bad Gateway).
Do i need to change something when using the api code in my javascript ?
Go to Sudarshan Dalavi Blog for more detailed information.
I’m facing the same issue but using fetch() in react. please help
Sir I too got the same response,
{
“messages”:“The API is unreachable, please contact the API provider”,
“info”:“Your Client (working) —> Gateway (working) —> API (not working)”
}
Sir, I use javascript (fetch method), Can someone helping me sir. I badly need this API working for me sir.
Thanks in advance.
David works, thanks
I ran into the same issue today using node.js. I was able to resolve the issue testing with the google translate API. Below is some sample code that runs from a node.js client and which should be easily adaptable to React. The trick is to use qs which is a querystring parsing and stringifying library with some added security. The example below translates “Hello World!” from English into Italian. Good luck!
let qs = require(‘qs’)
let axios = require(‘axios’)
const options = {
method: ‘POST’,
url: ‘https://google-translate1.p.rapidapi.com/language/translate/v2’,
data: qs.stringify({
q : ‘Hello World!’,
source : ‘en’,
target : ‘it’
}),
headers: {
‘content-type’: ‘application/x-www-form-urlencoded’,
‘accept-encoding’: ‘application/gzip’,
‘x-rapidapi-key’: ‘{{YOUR_API_KEY}}’,
‘x-rapidapi-host’: ‘google-translate1.p.rapidapi.com’
}
};
axios.request(options).then(function (response) {
console.log(response.data.data[‘translations’][0][‘translatedText’]);
}).catch(function (error) {
console.error(error);
});
This is response
{
“messages”:“The API is unreachable, please contact the API provider”,
“info”:“Your Client (working) —> Gateway (working) —> API (not working)”
}