|
| 1 | +--- |
| 2 | +group: rest-api |
| 3 | +title: In-Store Pickup |
| 4 | +contributor_name: Oleksandr Kravchuk |
| 5 | +contributor_link: https://github.com/swnsma |
| 6 | +--- |
| 7 | + |
| 8 | +The Inventory In-Store Pickup functionality exposes an endpoint that retrieves a list of pickup locations, and another endpoint that notifies the customer that their order is ready for pickup. |
| 9 | + |
| 10 | +**Service names:** |
| 11 | + |
| 12 | +```http |
| 13 | +inventoryInStorePickupApiGetPickupLocationsV1 |
| 14 | +inventoryInStorePickupSalesApiNotifyOrdersAreReadyForPickupV1 |
| 15 | +``` |
| 16 | + |
| 17 | +**REST endpoints:** |
| 18 | + |
| 19 | +```http |
| 20 | +GET /V1/inventory/in-store-pickup/pickup-locations |
| 21 | +POST /V1/order/notify-orders-are-ready-for-pickup |
| 22 | +``` |
| 23 | + |
| 24 | +## Search for pickup locations |
| 25 | + |
| 26 | +The `GET /V1/inventory/in-store-pickup/pickup-locations` endpoint searches for and filters on pickup locations, allowing the shopper to quickly narrow the results. The endpoint does not require authentication. |
| 27 | + |
| 28 | +Search terms, filters, and other attributes are specified as query parameters in the URL. This endpoint uses a different syntax than other Magento GET calls that send `searchCriteria` parameters. Instead, the `GET /V1/inventory/in-store-pickup/pickup-locations` endpoint requires that each query parameter begins with `searchRequest`. The `scopeCode` parameter is required. All other parameters are optional. |
| 29 | + |
| 30 | +Name | Type | Description |
| 31 | +--- | --- | --- |
| 32 | +`[scopeCode]=` | String | Required. The Sales Channel code of the assigned Stock. |
| 33 | +`[scopeType]=` | String | The Sales Channel type. The default value is `website`. |
| 34 | +`[area][radius]=` | Int | The radius, in kilometers, to search. The Distance Priority Algorithm must be configured to search an area. This parameter must be used with `[area][searchTerm]`. |
| 35 | +`[area][searchTerm]=` | String | The text to search, such as a city or region. This parameter must be used with `[area][radius]`. |
| 36 | +`[filters][country][value]=` | String | Filters by the specified `country_id`. |
| 37 | +`[filters][country][conditionType]=` | String | Optional. The default value is `eq`. |
| 38 | +`[filters][postcode][value]=` | String | Filters by the specified `postcode`. |
| 39 | +`[filters][postcode][conditionType]=` | String | Optional. The default value is `eq`. |
| 40 | +`[filters][region][value]=` | String | Filters by the specified `region`. |
| 41 | +`[filters][region][conditionType]=` | String | Optional. The default value is `eq`. |
| 42 | +`[filters][city][value]=` | String | Filters by the specified `city`. |
| 43 | +`[filters][city][conditionType]=` | String | Optional. The default value is `eq`. |
| 44 | +`[filters][street][value]=` | String | Filters by the specified `street`. |
| 45 | +`[filters][street][conditionType]=` | String | Optional. The default value is `eq`. |
| 46 | +`[filters][name][value]=` | String | Filters by the specified display `name`. |
| 47 | +`[filters][name][conditionType]=` | String | Optional. The default value is `eq`. |
| 48 | +`[filters][pickupLocationCode][value]=` | String | Filters by the specified source code name. |
| 49 | +`[filters][pickupLocationCode][conditionType]=` | String | Optional. The default value is `eq`. |
| 50 | +`[extensionAttributes][productsInfo][0][sku]=` | String | Returns a list of products with the specified SKU that are assigned to each pickup location. Locations without all the assigned products will be filtered out. |
| 51 | +`[extensionAttributes][productsInfo][0][extensionAttributes]=` | String | Extension point reserved for future use. |
| 52 | +`[pageSize]=` | Int | Specifies the maximum number of items to return. |
| 53 | +`[currentPage]=` | Int | Returns the current page. |
| 54 | +`[sort][0][field]=` | String | Specifies the field to sort on. |
| 55 | +`[sort][0][direction]=` | String | Specifies whether to return results in ascending (`ASC`) or descending (`DESC`) order. The default is `DESC`. |
| 56 | + |
| 57 | +[Search using REST endpoints]({{page.baseurl}}/rest/performing-searches.html) provides a full list of supported condition types. |
| 58 | + |
| 59 | +**Sample Usage:** |
| 60 | + |
| 61 | +`GET <host>/rest/<store_code>/V1/inventory/in-store-pickup/pickup-locations` |
| 62 | + |
| 63 | +**Payload:** |
| 64 | + |
| 65 | +Define the payload as part of the `GET` request string. |
| 66 | + |
| 67 | +```http |
| 68 | +searchRequest[area][radius]=1500& |
| 69 | +searchRequest[area][searchTerm]=Austin& |
| 70 | +searchRequest[scopeCode]=base& |
| 71 | +searchRequest[extensionAttributes][productsInfo][0][sku]=SKU1 |
| 72 | +``` |
| 73 | + |
| 74 | +**Response:** |
| 75 | + |
| 76 | +Magento returns Pickup Locations list, search request given and total results count. |
| 77 | + |
| 78 | +```json |
| 79 | +{ |
| 80 | + "items": [ |
| 81 | + { |
| 82 | + "pickup_location_code": "txspeqs", |
| 83 | + "name": "Sport Equipment Store", |
| 84 | + |
| 85 | + "contact_name": "Ethan Carter", |
| 86 | + "description": "Sport Equipment Store description", |
| 87 | + "latitude": 29.7543, |
| 88 | + "longitude": -95.3609, |
| 89 | + "country_id": "US", |
| 90 | + "region_id": 57, |
| 91 | + "region": "Texas", |
| 92 | + "city": "Houston", |
| 93 | + "street": "4631 Airport Blvd #125", |
| 94 | + "postcode": "77010", |
| 95 | + "phone": "(555) 555-5555" |
| 96 | + } |
| 97 | + ], |
| 98 | + "search_request": { |
| 99 | + "area": { |
| 100 | + "radius": 1500, |
| 101 | + "search_term": "Austin" |
| 102 | + }, |
| 103 | + "current_page": 1, |
| 104 | + "scope_type": "website", |
| 105 | + "scope_code": "base", |
| 106 | + "extension_attributes": { |
| 107 | + "products_info": [ |
| 108 | + { |
| 109 | + "sku": "SKU1" |
| 110 | + } |
| 111 | + ] |
| 112 | + } |
| 113 | + }, |
| 114 | + "total_count": 1 |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +## Mark an order as ready for pickup |
| 119 | + |
| 120 | +The `POST /V1/order/notify-orders-are-ready-for-pickup` endpoint creates a shipment and sends an email notifying the customer that the order is ready to be picked up. |
| 121 | +The endpoint requires appropriate permission to resource `Magento_InventoryInStorePickupApi::notify_orders_are_ready_for_pickup`. |
| 122 | + |
| 123 | +**Sample Usage:** |
| 124 | + |
| 125 | +`POST <host>/rest/<store_code>/V1/order/notify-orders-are-ready-for-pickup` |
| 126 | + |
| 127 | +**Payload:** |
| 128 | + |
| 129 | +```json |
| 130 | +{ |
| 131 | + "orderIds": [ |
| 132 | + 81 |
| 133 | + ] |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +**Response:** |
| 138 | + |
| 139 | +Magento returns an array with success status and an array of error messages for each failed order. |
| 140 | + |
| 141 | +```json |
| 142 | +{ |
| 143 | + "successful": true, |
| 144 | + "failed": [] |
| 145 | +} |
| 146 | +``` |
0 commit comments