# Search Backend API Interactions [TOC] ## Search ### Request flow ```sequence Frontend -> "marketplace-feed-service": Search query "marketplace-feed-service" -> contentful: Get Feed contentful -> "marketplace-feed-service": Feed Note left of "marketplace-feed-service": Content entries: \n ShopCollection \n ShopWithProductsCollection \n ProductCollection \n Reorder "marketplace-feed-service" -> "search-service": Content entry query Note right of "search-service": Endpoints: \n /v1/discover/shops \n /v1/discover/products \n /v1/discover/shops-with-products \n /v1/count/shops "search-service" -> "marketplace-feed-service": Content entry response "marketplace-feed-service" -> Frontend: Search response ``` ### Marketplace-feed-service requests docs | Search Service | Docs | | ----------------- |:------------------------- | | OpenAPI Docs | [:link:][OpenAPI Docs] | [OpenAPI Docs]:https://github.com/slicelife/marketplace-feed-service/blob/master/openapi.yml :::spoiler Marketplace-feed-service query examples ```curl curl "https://marketplace-feed-service.private.qa.slicelife.com/api/v1/search/query?latitude=41.89132069999999488&longitude=-87.6554683&query=Pizzeria&isDelivery=true&feedName=products-with-salad" \ -H 'Content-Type: application/json' ``` ```curl curl "https://marketplace-feed-service.private.qa.slicelife.com/api/v1/search/query?latitude=41.89132069999999488&longitude=-87.6554683&query=Pizzeria&isDelivery=true&feedName=shop-search-w-search-query-collection-verticalish" \ -H 'Content-Type: application/json' ``` ::: ---- ## Map ### Request flow ```sequence Frontend -> "Core": Search query "Core" -> "search-service": "search-service" -> "Core": "Core" -> Frontend: ``` ### API documentation #### Content entry requests docs | Search Service | Docs | | ----------------- |:------------------------- | | OpenAPI Docs | [:link:][OpenAPI Docs] | | Discover Shops | [:link:][Discover Shops] | | Discover Prodicts | [:link:][Discover Products] | | Discover Shops With Prodicts | [:link:][Discover Shops With Prodicts] | [OpenAPI Docs]: https://github.com/slicelife/search-service/blob/master/openapi.yaml [Discover Shops]: https://github.com/slicelife/search-service/blob/master/openapi.yaml#L201 [Discover Products]: https://github.com/slicelife/search-service/blob/master/openapi.yaml#L250 [Discover Shops With Prodicts]: https://github.com/slicelife/search-service/blob/master/openapi.yaml#L299 :::info For better Doc exploring experience you can use [Swagger](https://swagger.dev.slicelife.com/) and put link to ***raw*** file in there ::: #### Endpoint :::info ``` https://consumer.[prod|qa|dev].slicelife.com/services/core/api/v1/discover/shops ``` ::: :::spoiler Example Request ```json= { "sorts": [ { "sort_type": "nearby", "longitude": -83.00374215923756, "latitude": 39.989655647576086 } ], "filters": [ { "filter_type": "within_radius", "latitude": 39.989655647576086, "longitude": -83.00374215923756, "radius": 1.7362793961090774 }, { "filter_type": "is_acquired" } ] } ``` ::: :::spoiler Example Response ```json= { "data": [ { "id": "04b11dbf-3025-4030-9b51-331aded42a17", "type": "shops", "attributes": { "address": "127 E 5th Ave", "acquired": true, "city": "Columbus", "order_minimum_range": "$15.0", "delivery_cost_range": "$4.95", "delivery_fee_type": "flat", "discount_percent": 0.0, "image_url": "https://shop-logos.imgix.net/shops/30321/original/Del_Baggio_Pizzeria.png", "is_open_for_delivery": false, "is_open_for_pickup": false, "max_delivery_estimate": 45, "max_pickup_estimate": 30, "min_delivery_estimate": 30, "min_pickup_estimate": 15, "pickup_minimum": 0.0, "rating": 4.79, "display_rating": 4.79, "ratings_count": 26, "should_display_rating": true, "shop_id": 30321, "shop_name": "Del Baggio Pizzeria", "state": "OH", "web_slug": "oh/columbus/43201/del-baggio-pizzeria", "zipcode": "43201", "latitude": "39.9866888", "longitude": "-83.0017457", "distance_to_user": null, "cuisines": [ { "name": "healthy pizza", "seo_representation": "healthy-pizza" }, { "name": "veggie pizza", "seo_representation": "veggie-pizza" } ], "ovr": 0.45, "delivery_info": { "delivers_to_user": null, "fee_amount": null, "fee_range": { "max": 4.95, "min": 4.95, "type": "flat" }, "fee_type": null, "minimum_order": null, "minimum_order_range": { "max": 15.0, "min": 15.0 } }, "hero_image_url": "https://slicelife.imgix.net/30321/photos/original/app-heroes11_(1).jpg?auto=compress&auto=format", "has_coupons": false, "has_menu": true, "phone": "6142975000", "slug": "del-baggio-pizzeria", "shop_title": "", "twilio_phone": "6146981252" } }, { "id": "076ff634-e964-40cd-8a89-ad8efc7400a5", "type": "shops", "attributes": { "address": "1497 N High St", "acquired": true, "city": "Columbus", "order_minimum_range": "$0.0", "delivery_cost_range": "$6.9", "delivery_fee_type": "flat", "discount_percent": 0.0, "image_url": "https://shop-logos.imgix.net/shops/33961/original/portofinos.JPG", "is_open_for_delivery": false, "is_open_for_pickup": false, "max_delivery_estimate": 45, "max_pickup_estimate": 30, "min_delivery_estimate": 30, "min_pickup_estimate": 15, "pickup_minimum": 0.0, "rating": 4.71, "display_rating": 4.71, "ratings_count": 267, "should_display_rating": true, "shop_id": 33961, "shop_name": "Porto Fino's Pizza", "state": "OH", "web_slug": "oh/columbus/43201/porto-fino-s-pizza", "zipcode": "43201", "latitude": "39.9928771", "longitude": "-83.0068321", "distance_to_user": null, "cuisines": [ { "name": "healthy pizza", "seo_representation": "healthy-pizza" } ], "ovr": 0.84, "delivery_info": { "delivers_to_user": null, "fee_amount": null, "fee_range": { "max": 6.9, "min": 6.9, "type": "flat" }, "fee_type": null, "minimum_order": null, "minimum_order_range": { "max": 0.0, "min": 0.0 } }, "hero_image_url": "https://slicelife.imgix.net/33961/photos/original/product-all-meat-pizza-12959609.jpeg?auto=compress&auto=format", "has_coupons": false, "has_menu": true, "phone": "6142942949", "slug": "porto-fino-s-pizza", "shop_title": "", "twilio_phone": "6146608023" } }, // ... ], "meta": { "applied_filters": [ { "filter_type": "within_radius", "latitude": 39.98965564757609, "longitude": -83.00374215923756, "radius": 1.736279396109077 }, { "filter_type": "is_acquired" } ], "applied_match": [], "applied_sorts": [ { "latitude": 39.98965564757609, "longitude": -83.00374215923756, "sort_type": "nearby" } ], "flags": { "preorder_etas_v2": true }, "pagination": { "from": 0, "size": 50, "total_results": 12 }, "requested_filter_types": [ "within_radius", "is_acquired" ], "requested_sort_types": [ "nearby" ], "supported_filter_types": [ "within_radius", "delivers_to", "shop_identifiers", "delivery_fees", "delivery_minimum_limit", "is_acquired", "is_unacquired", "chain", "cities_and_states", "onboarded_days_ago", "zip_codes", "areas", "exclude_shop_identifiers", "discount_range", "is_open_for", "is_open", "hero_image", "min_rating", "delivery_provider", "cuisines", "has_featured_products", "does_not_have_featured_products", "loyalty_enabled", "shop_name_contains", "delivers_to_or_within_radius", "within_radius_and_does_not_deliver_to", "does_not_deliver_to", "post_sales_service_channel", "shop_integration_adoption", "product_name", "product_name_contains", "in_visible_category", "in_stock", "has_image", "product_category" ], "supported_sort_types": [ "nearby", "recommended", "delivery_estimate", "discount", "acquired", "ovr", "rating", "is_open", "pickup_estimate", "loyalty_enabled", "bucketed_distance_sort" ] } } ``` :::