Search John Lewis products
Automatically search John Lewis products on johnlewis.com. Search the John Lewis UK store (johnlewis.com) by free-text query and return one page of products (72 per page) in the site's relevance order. Returns the query, page, total count, page count (stated on page 1 only), has_next_page, the searches John Lewis suggests, and items: product number, link, title, brand, lowest and highest price in pounds sterling, earlier price when reduced, image, rating, review count, availability, default sku id, colours with their sku ids, and offer labels. A query with no match returns an empty list; John Lewis can also answer a query it cannot match with a list of popular products, which the script returns as the site shows it. A page past the last one returns an empty list.
Inputs
query requiredFree-text search, for example "kettle".
page optionalResults page, 72 products per page. Stop when has_next_page is false.
Default: 1Output
url requiredpage requireditems requiredquery requiredcurrency requiredGBP
page_count requiredNumber of pages John Lewis states; it states it on page 1 only.
suggestions requiredOther searches John Lewis suggests for this query.
total_count requiredNumber of products John Lewis states for the search; null on a page past the end.
has_next_page requiredFAQ
Remove John Lewis product from basket
Remove a product from the John Lewis UK store (johnlewis.com) basket of this browser by its product id (the sku id, as returned by List John Lewis basket items), whatever its quantity, and return what is left in the basket: each line with its line id, product id, offer id, name with the brand, seller, quantity, unit price and line price, plus the item count, the basket total and the currency (GBP). A product that is not in the basket is reported with removed false and the basket unchanged, not as a failure. Works as a guest, with no account.
Add John Lewis product to basket
Add a product of the John Lewis UK store (johnlewis.com) to the basket of this browser, by its product number or link, with a quantity from 1 to 10, and return the whole basket afterwards: each line with its line id, product id (the sku id), offer id (always null), name with the brand, seller, quantity, unit price and line price, plus the item count, the basket total and the currency (GBP). A product with several colours or sizes needs the sku id of one of them (sku_id of Get John Lewis product). Works as a guest, with no account: lines already in the basket stay and are listed too. Nothing is paid or ordered. A variant that cannot be ordered, an unknown product number or sku id, and a link that is not a John Lewis product page fail with an error that says so. On a cloud browser, John Lewis accepts the add only from a UK address (country GB).
List John Lewis basket items
List the items in the John Lewis UK store (johnlewis.com) basket of this browser, as the site holds it: for each line its line id, product id (the sku id of the exact colour or size), offer id (always null), name with the brand, seller (always John Lewis), quantity, unit price and line price, plus the number of items, the basket total before delivery and the currency (GBP). The basket is the guest basket of the browser, so no sign-in is needed. An empty basket returns an empty list and a zero count. Saved-for-later items are not included.
