Skip to content

Detail API

Victor Mendez edited this page Mar 19, 2023 · 9 revisions
  • The detail API endpoint can be used to get more detailed information for different subject matters such as restaurants and locations. The endpoint follows the format detail/{subjectMatter}. Ex: detail/restaurant to get detailed info about a specific restaurant or detail/location to get specific information about a location such as latitude and longitude data

Store

Usage Example:

const url = "http://localhost:8000/api/detail/store";

const options = {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    {
    "serviceIds": {
        "postmates": "232db0de-74ff-4110-85fa-67ed826a0ff7",
        "grubhub": "3239992",
        "doordash": null
    },
    "page": 3
}
  }),
};

fetch(url, options)
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch((err) => console.error("error:" + err));
  • Note that service names are lower case, ie: postmates, doordash, grubhub
  • Currently doordash is implemented using an automated web browser, as such, doordash results will take considerably longer to be retrieved.

Response Example

{
  "id": "cd547c09-4028-479c-8bc6-3b4325b12d12",
  "name": "Starbucks (Broadway & Magnolia)",
  "image": "https://tb-static.uber.com/prod/image-proc/processed_images/f5a96cf1e6e2a578b0783c486530aa75/69ad85cd7b39888042b3bbf1c22d630d.jpeg",
  "hours": [
    {
      "dayRange": "Sunday",
      "sectionHours": [
        {
          "startTime": 300,
          "endTime": 1200,
          "sectionTitle": ""
        }
      ]
    },
    {
      "dayRange": "Monday - Friday",
      "sectionHours": [
        {
          "startTime": 270,
          "endTime": 1230,
          "sectionTitle": ""
        }
      ]
    },
    {
      "dayRange": "Saturday",
      "sectionHours": [
        {
          "startTime": 300,
          "endTime": 1200,
          "sectionTitle": ""
        }
      ]
    }
  ],
  "location": {
    "streetAddress": "421 West Broadway",
    "city": "Long Beach",
    "zipCode": "90802",
    "country": "US"
  },
  "menu": [
    {
      "categoryId": "7e12b8f3-87df-5fc1-9e20-fe61f4894ee7",
      "category": "Picked for you",
      "items": [
        {
          "id": "7d6ff573-2be1-5a45-adc7-b742c3e85b55",
          "name": "Iced Chai Tea Latte",
          "description": "Black tea infused with cinnamon, clove, and other warming spices are combined with milk and ice for the perfect balance of sweet and spicy.",
          "price": 495,
          "image": "https://d1ralsognjng37.cloudfront.net/169f41d7-b5f7-4873-bea2-894fe6b3082f.jpeg",
          "subsectionId": "7e12b8f3-87df-5fc1-9e20-fe61f4894ee7"
        }
      ]
    }
  ]
}
  • The above response example has been truncated.
  • Time data for stores are different for all services and there does not seem to be a common format.
  • Grhubhub responses also include fee information.

Location

Usage Example:

const url = "http://localhost:8000/api/detail/location";

const options = {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    id: "c2523974-0f10-358d-8de9-8de58a6abcd1",
    provider: "uber_places",
    addressLine1: "Los Angeles International Airport (LAX)",
    addressLine2: "1 World Way, Los Angeles",
  }),
};

fetch(url, options)
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch((err) => console.error("error:" + err));
  • LocationData is an object that can be acquired using the autocomplete/location endpoint

Response Example

{
  "address": {
    "address1": "Los Angeles International Airport (LAX)",
    "address2": "1 World Way, Los Angeles",
    "aptOrSuite": "",
    "eaterFormattedAddress": "1 World Way, Los Angeles, CA 90045, US",
    "subtitle": "1 World Way, Los Angeles",
    "title": "Los Angeles International Airport (LAX)",
    "uuid": ""
  },
  "latitude": 33.9431702,
  "longitude": -118.4001692,
  "reference": "c2523974-0f10-358d-8de9-8de58a6abcd1",
  "referenceType": "uber_places",
  "type": "uber_places",
  "source": "manual_auto_complete",
  "addressComponents": {
    "countryCode": "US",
    "firstLevelSubdivisionCode": "CA",
    "city": "Los Angeles",
    "postalCode": "90045"
  },
  "originType": "user_autocomplete"
}

The response above can be passed to /set/location to set the location for the current session. After the location has been set, the /search api can be called to obtain results in a specific location.

Clone this wiki locally