Google Translate

免费增值
通过 Google Cloud | 已更新 месяц назад | Text Analysis
人气

9.9 / 10

延迟

457ms

服务等级

100%

Health Check

N/A

返回所有讨论

Getting 403 error. Shocking and disappointing

Rapid account: Bismoy
bismoy
4 года назад

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 года назад

same here 403 error very disappointing

Rapid account: Rapid Alex
RapidAlex Commented 4 года назад

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 года назад

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

Rapid account: Ekoremdev
ekoremdev Commented 4 года назад

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

加入讨论 - 在下面添加评论:

登录/注册以发布新的评论