Error calling service "auto-complete"

Asked

Viewed 48 times

0

I am finalizing a system and now arose the need to present to the user a field with autocomplete.

So I got the idea to use the autocomplete of the dictionary Michaelis.

If you access the WEBSITE will see that you have in the search field when typing appears the word suggestions.

I managed to find the following service http://michaelis.uol.com.br/suggest/

But I’m not getting past the parameters, you can help me with this problem?

Edit:

What I want to do is just like the site http://dictionary.cambridge.org/pt/autocomplete/english/? q=Ask

That returns a json with word suggestions, play this link in Postman to see the return.

  • See if the link helps https://answall.com/questions/31885/dicion%C3%A1rio-portugu%C3%Aas-online-para-fazer-requests

  • Marquezani, but I did not want the result of the word search, I would like to use the service of suggestions, as you type will appear the words.

  • http://api.jqueryui.com/autocomplete/#entry-examples

  • Marconcilio, ever imagined I put all the words in Portuguese? If you already have the service just use it.

1 answer

2


I managed to call the service quoted as follows:

I simulated by the browser and checked which parameters were passed to the service. Below is the successful simulation. In addition to the parameter word, shall also pass other three parameters: r, f and t there is also a fifth parameter _csrf but the call worked even without it. Also note that the parameter type is x-www-form-urlencoded put down also a c# code for the call.

inserir a descrição da imagem aqui

var client = new RestClient("http://michaelis.uol.com.br/suggest/");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "3e206738-01a8-46b6-0952-bc776e3d1608");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "r=0&f=0&t=0&palavra=coletor", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
  • Great Alexander! Perfect here was tbm missing some parameters, I just found it strange that my accent is wrong: {"suggestions":[{"value":"c u00f3lera"},{"value":"colerado"},{"value":"c u00f3lera-Morbo"}]}

  • I forgot to put but used as test word "Collector". If solved, mark this answer as valid. ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.