Google Translate

FREEMIUM
Por Google Cloud | Actualizada vor einem Monat | Text Analysis
Popularidad

9.9 / 10

Latencia

457ms

Nivel de servicio

100%

Health Check

N/A

Volver a todas las conversaciones

Getting 403 error. Shocking and disappointing

Rapid account: Bismoy
bismoy
vor 4 Jahren

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 vor 3 Jahren

same here 403 error very disappointing

Rapid account: Rapid Alex
RapidAlex Commented vor 4 Jahren

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 vor 4 Jahren

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

Rapid account: Ekoremdev
ekoremdev Commented vor 4 Jahren

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

Únase a la conversación, añada un comentario a continuación:

Inicie sesió/Regístrese para publicar nuevos comentarios