Skip to content

Set API

Alfredo Sequeida edited this page Feb 24, 2023 · 9 revisions
  • The set API endpoint can be used to set values in the backend or retrieve data to be set in the frontend in the form of cookies.

location

  • Wraps Postmate's set location API.
  • Set location to be used for searching. This endpoint does not return anything, but sets a cookie in the browser with the location data.

Usage Example

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

const options = {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  credentials: "include",
  body: JSON.stringify({
    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",
  }),
};

fetch(url, options)
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch((err) => console.error("error:" + err));

Response Example

{"cookies": ...}
  • The response returns object of cookies from delivery services (ie. Postmates) that can be used in both mobile and web API calls to retrieve search data for a specific location. See /api/search for more information.

Clone this wiki locally