-
Notifications
You must be signed in to change notification settings - Fork 5
Autocomplete API
Alfredo Sequeida edited this page Feb 24, 2023
·
9 revisions
- The following are autocomplete APIs, these can be called repetitively for quick searches. The endpoints follow the format
/autocomplete/{specificAction}ex:/autocomplete/locationfor auto completing location info orautocomplete/searchfor autocompleting service search results
- The autocomplete location API wraps Postmates's/UberEats' Web autocomplete location API
const url = "http://localhost:8000/api/autocomplete/location";
const options = {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query: "los ang" }),
};
fetch(url, options)
.then((res) => res.json())
.then((json) => console.log(json))
.catch((err) => console.error("error:" + err));[
{
"id": "c2523974-0f10-358d-8de9-8de58a6abcd1",
"provider": "uber_places",
"addressLine1": "Los Angeles International Airport (LAX)",
"addressLine2": "1 World Way, Los Angeles"
},
{
"id": "ChIJE9on3F3HwoAR9AhGJW_fL-I",
"provider": "google_places",
"addressLine1": "Los Angeles",
"addressLine2": "CA, USA"
},
{
"id": "72e67e9e-cb47-376c-f40e-df08fb63e1e6",
"provider": "uber_places",
"addressLine1": "Terminal 6",
"addressLine2": "Gates 60 - 69, Los Angeles International Airport (LAX), Los Angeles"
},
{
"id": "71124a11-c28a-3340-b39d-cd887ce01f52",
"provider": "uber_places",
"addressLine1": "Terminal 2",
"addressLine2": "Gates 21 - 28, Los Angeles International Airport (LAX), Los Angeles"
},
{
"id": "863e5e44-1bae-335b-b7bf-0474d7d7d484",
"provider": "uber_places",
"addressLine1": "Los Angeles Airport Marriott",
"addressLine2": "5855 W Century Blvd, Los Angeles"
}
]- The above data can be passed into the
detail/locationapi endpoint to get more detailed information about a location such as latitude and longitude info.
The autocomplete search API wraps Postmates's/UberEats' Web autocomplete search API. Location cookies required before performing a search. See api/set/location for more information.
const url = "http://localhost:8000/api/autocomplete/search";
const options = {
method: "POST",
credentials: "include",
headers: { "Content-Type": "application/json" },
body: JSON.stringiy({"query":"pizz", cookies: {..., "uev2.loc":""}}),
};
fetch(url, options)
.then((res) => res.json())
.then((json) => console.log(json))
.catch((err) => console.error("error:" + err));Note: for the cookies object, ... means other cookies, note that the uev2.loc cookie is required to be part of those cookies. These cookies can be obtained from the /set/location API.
[
{
"uuid": "72a3b19e-d91b-4ddd-8524-47f4df6f0e8e",
"title": "Borgata Pizza Cafe",
"image": "https://d1ralsognjng37.cloudfront.net/7ed5c1fa-e95c-4ed7-bb86-44ac815acd6f.jpeg"
},
{
"uuid": "d1f32844-e38a-46c0-a045-5b3992223a1f",
"title": "Donatos Pizza (Mill Run)",
"image": "https://tb-static.uber.com/prod/image-proc/processed_images/edc3195c76c33da87ba6845b3b0e548b/820883a48567670acbd720bc76391291.jpeg"
}
]