STAGINGOpen PROD

Build on the Partner API

View as Markdown

Searching the catalog

Last updated

Nobody reads documentation.

Here are the instructions for your agent. Give it this prompt: it reads the guides and the API contract, then walks you through the integration step by step, what to do, where and how.

Download agent instructions

This guide is for builders of a website, app or agent on the Partner API.

To answer one shopper's request, search: one call returns the best matching offers in your inventory scope, ranked the way groupon.com ranks them. Walk the catalog only when your site renders the whole catalog from its own copy (Syncing the catalog).

bash
curl -s "https://api-staging-core.livingsocial.com/partner_storefront/products/search?q=massage%20in%20Chicago&country=US&limit=5" \
  -H "Authorization: Bearer $GROUPON_API_KEY"
ParameterMeaning
qRequired: the shopper's words, 1 to 200 characters. A place in them is understood (massage in Chicago)
countryRequired: US or CA
cityA city, used when the words name no place. See "Cities" below
nearlat,lng,radius: the radius in kilometres (41.88,-87.63,10) or in miles with mi (41.88,-87.63,6mi), at most 200 km (124 mi). Closer offers rank higher
minPriceWhole dollars: only offers with an option at or above it
maxPriceWhole dollars: only offers with an option at or under it. With minPrice, one option must sit inside both
minRating0 to 5: only offers whose merchant is rated at least this, as merchantRating.average reads (4.5). An offer with no rating is left out
sortrelevance (the default), rating (the merchant's rating, best first), price_asc or price_desc. The order holds across every page. Any other value is refused with 400
category0, category1, category2A category path from GET /partner_storefront/categories (below), inside your scope
stateA full US state name, as on the walk, inside your scope
limit1 to 50, 10 when absent; a conversation needs 3 to 5
cursorThe previous page's nextCursor

The answer holds data (each item is the same product a walk returns, with its merchantRating, its own rating, bought, finePrint and each location's hours, plus distanceKm and distanceMiles when you sent near), nextCursor, hasMore, total (how many match inside your storefront's scope: exact when the first page is also the last, else Groupon's estimate), asOf and scope, what was searched (see "Rules"). Only offers on sale today are returned. A ticket booked on groupon.com is returned too (availabilityRequired: true, each option with a bookingUrl that opens Groupon's booking page with the option chosen, where the shopper picks the day and time and pays); read its free days and times with GET /partner_storefront/products/:productId/availability. Every open offer Groupon books on its own calendar in the US through its third-party booking partners is returned this way; where a supplier does not answer its free days and times, the option's bookingUrl is still where the shopper books and pays. Any other product Groupon's cart cannot take, a hotel stay booked by its dates among them, is returned with availabilityRequired: true and the product's own bookingUrl, its page on groupon.com. A hotel stay also says hotelStay: true: read its rooms and rates for the shopper's dates with GET /partner_storefront/products/:productId/stays (Hotel stays). The free slots may come from the supplier's own booking system when the partner is connected directly, and are then at most five minutes old; otherwise they come from Groupon's booking calendar, refreshed hourly. The answer's asOf says when they were read. Every slot price is before Groupon's taxes and fees, added at checkout, and the availability answer says so in priceNote: never show a total, the shopper sees it on Groupon's checkout. To keep one slot while the shopper pays, hold it (Holding a timed slot).

Every product says in one word how the shopper gets a time, bookingKind: read it before you promise a day or a time, never availabilityRequired alone. bookable_with_live_times: its free days and times are read live with the availability read above, one can be held, and the shopper pays for exactly that time on Groupon's page. no_time_held: buying it holds no time; the shopper buys it, then books the time with the merchant afterwards, as the fine print says. stay: a hotel stay, its dates chosen when it is booked. shipped: a product shipped to the shopper, bought with its delivery on its own Groupon page (bookingUrl), never in a cart.

Sort and rating

bash
curl -s "https://api-staging-core.livingsocial.com/partner_storefront/products/search?q=spa%20day%20in%20Chicago&country=US&sort=rating&minRating=4.5&limit=5" \
  -H "Authorization: Bearer $GROUPON_API_KEY"

sort=rating returns the best-rated merchants first and minRating=4.5 keeps only merchants rated 4.5 or more, so a 3.1-star offer never sits next to a 4.9-star one. Both work on every page of the search, and with every other filter. The rating is the one each product answers in merchantRating: groupon.com's rating of the merchant, to one decimal. A price order follows the price Groupon's search holds for each offer, which can trail the live price in options, so now and then a neighbour sits a little out of order: sort the page you show by price.retail if you need it exact. There is no newest-first order: Groupon's search orders by relevance, rating and price only.

Categories

bash
curl -s "https://api-staging-core.livingsocial.com/partner_storefront/categories" \
  -H "Authorization: Bearer $GROUPON_API_KEY"

The answer lists every category path of the offers on sale in your scope, once each: category0 (local), category1 (things-to-do), category2 (escape-rooms) and products, how many offers sit under exactly that path now. Send any of the three as the filter of the same name. Read the list once a day: it changes as offers come and go.

Cities

city matches the whole city name, with capitals ignored (chicago finds Chicago). It never matches part of a name, and it takes no wildcards: Chi and Chi% find nothing. A state may follow the city, as a two-letter code (Portland OR, Portland, OR) or a full name after a comma (Portland, Oregon); only that city in that state is then searched, so Portland, OR leaves out Portland, Maine, while a place whose state is not on record is kept. Anything else after the comma is ignored.

Rules

  • A search that names no place, in the words (massage in Chicago), with city or with near, is ranked around Chicago, the place groupon.com ranks such a search around. scope says what was searched: kind (words, near, city, default when no place was named, or national), the place (Chicago for default, null for near and national) and a note, one sentence to tell the shopper. When it is default and the shopper has a place in mind, ask for it.
  • Send the same parameters on every page; only cursor changes. A page can be short while hasMore is true. A cursor works for 15 minutes: it is a place in Groupon's live ranking, which moves as offers come and go, so an older one could skip an offer or repeat one. After 15 minutes, or on BAD_REQUEST for a lapsed cursor, search again with the same parameters and no cursor, and skip the products you already hold by their id. To keep the whole catalog, walk it instead: a walk's cursor lasts a week.
  • Each search counts once against your storefront's requests a minute (600 by default), and against 120 searches a minute per storefront. Past either, the answer is RATE_LIMITED with retryAfterSeconds.
  • UPSTREAM_UNAVAILABLE means the ranking could not answer: retry with backoff.
  • Read one offer again before you show it with GET /partner_storefront/products/{productId}. An offer that is gone or outside your scope answers INVALID_PRODUCT_ID.
  • Results come from LivingSocial for Agents' copy of Groupon's catalog, refreshed every hour. The cart checks price and availability live, so send expectedPrice as always.