Google Translate

FREEMIUM
Por Google Cloud | Atualizado un mese fa | Text Analysis
Popularidade

9.9 / 10

Latência

457ms

Nível de serviço

100%

Health Check

N/A

Voltar para todas as discussões

Getting 403 error. Shocking and disappointing

Rapid account: Bismoy
bismoy
4 anni fa

import java.io.IOException;

import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;

public class Test {
public static void main(String args[]) throws IOException {
OkHttpClient client = new OkHttpClient();

	MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
	RequestBody body = RequestBody.create(mediaType, "source=en&q=Hello%2C%20world!&target=es");
	Request request = new Request.Builder().url("https://google-translate1.p.rapidapi.com/language/translate/v2")
			.post(body).addHeader("x-rapidapi-host", "google-translate1.p.rapidapi.com")
			.addHeader("x-rapidapi-key", "ea255af93fmsh4ac35f6a83472adp1b5328jsne60af6a2b885")
			.addHeader("accept-encoding", "application/gzip")
			.addHeader("content-type", "application/x-www-form-urlencoded")
			.build();

	Response response = client.newCall(request).execute();
	System.out.println(response.message());
}

}

Rapid account: Ravik 2492
ravik2492 Commented 3 anni fa

same here 403 error very disappointing

Rapid account: Rapid Alex
RapidAlex Commented 4 anni fa

Hey folks, could you try removing the .addHeader("accept-encoding", "application/gzip") from the request? We’ve been noticing some issues with a few APIs on the platform that utilize gzip encoding.

Rapid account: Ekoremdev
ekoremdev Commented 4 anni fa

same error here. i receive 403 error on my first use of api endpoint.

Rapid account: Ekoremdev
ekoremdev Commented 4 anni fa

same error here. i receive 403 error on my first use of api endpoint.

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários