nicolas asinovich
nicolas asinovich

Reputation: 3521

Throwable = Malformed URL. Base: https://speech.googleapis.com/v1/, Relative: speech:longrunningrecognize

I'm testing requests on Android use Retrofit2 and I get this throwable.

URL_BASE = "https://speech.googleapis.com/v1/";

My request

@POST("speech:longrunningrecognize")
    Call<String> longRecognize(@Query("key") String key,
                               @Body LongRunningRecognize loginResponse);

And when clicked

btnInitialSpeech.setOnClickListener(v -> {
            RestClient.INSTANCE.getApiServiceInterface()
                    .longRecognize(GOOGLE_API_KEY, getLongRecognize(f.getName()))
                    .enqueue(new Callback<String>() {
                        @Override
                        public void onResponse(Call<String> call, Response<String> response) {
                            if (response.isSuccessful()) {
                                String body = String.valueOf(response.body());
                                Log.d(TAG, "Response = " + body);
                            }
                        }

                        @Override
                        public void onFailure(Call<String> call, Throwable t) {
                            Log.d(TAG, "Throwable = " + t.getMessage());

                        }
                    });
        });

I created project and doing all like here https://cloud.google.com/speech/docs/async-recognize Please, tell me what is wrong?

Upvotes: 1

Views: 510

Answers (1)

nicolas asinovich
nicolas asinovich

Reputation: 3521

I figured it out.

Here speech:longrunningrecognize instead ":" need "/".

Upvotes: 3

Related Questions