Update an order item as a shopper
PUT /v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items/{line_num}
Updates an order item as a shopper.
The following table describes the valid values for the status
attribute.
Status | Description |
---|---|
not_found | Before shopping starts, all items have this status. |
found | Shopper finds the item. You can adjust the delivered_count to simulate a shopper finding some of the item but not the quantity that the customer ordered. |
replaced | Shopper replaces an item. You can specify the replacement item and delivered_count . |
to_refund | Shopper can't find the item or a replacement. Set the delivered_count to 0 when you use this status. |
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
shopper_id | path | integer | The ID of the shopper. | |
order_id | path | string | The ID of the order. | |
line_num | path | string | The line number of the item. | |
X-Treat-Ids-As-Internal | header | boolean |
Request
Field | Type | Required | Description |
---|---|---|---|
delivered_count | integer | The delivered count of the item. Must be a non-negative integer. | |
delivered_weight | number | The delivered weight of the item (defaults to lbs in the US). Must be a non-negative number. | |
status | string | The status of the item. | |
replacement_item | Replacement_item | The replacement item. | |
scans | Array(ShopperOrderItemScan) | The barcodes scans. |
ShopperOrderItemScan Object
Field | Type | Required | Description |
---|---|---|---|
scanned_string | string | The barcode scanned. | |
scanned_string_type | string | The type of barcode scanned. |
Replacement_item Object
One of the following:
Field | Type | Required | Description |
---|---|---|---|
upc | string | The item's universal product code. |
or
Field | Type | Required | Description |
---|---|---|---|
rrc | string | The item's retailer reference code. |
Request examples
- cURL
- Java
- Python
- Go
curl --request PUT \
--url 'https://connect.instacart.com/v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items/{line_num}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Treat-Ids-As-Internal: true' \
--data '{
"delivered_count": 1,
"delivered_weight": 1,
"status": "string",
"replacement_item": {
"upc": "string"
},
"scans": [
{
"scanned_string": "string",
"scanned_string_type": "string"
}
]
}'
HttpResponse<String> response = Unirest.put("https://connect.instacart.com/v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items/{line_num}")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.header("X-Treat-Ids-As-Internal", "true")
.body("{\n \"delivered_count\": 1,\n \"delivered_weight\": 1,\n \"status\": \"string\",\n \"replacement_item\": {\n \"upc\": \"string\"\n },\n \"scans\": [\n {\n \"scanned_string\": \"string\",\n \"scanned_string_type\": \"string\"\n }\n ]\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"delivered_count\": 1,\n \"delivered_weight\": 1,\n \"status\": \"string\",\n \"replacement_item\": {\n \"upc\": \"string\"\n },\n \"scans\": [\n {\n \"scanned_string\": \"string\",\n \"scanned_string_type\": \"string\"\n }\n ]\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>",
'X-Treat-Ids-As-Internal': "true"
}
conn.request("PUT", "/v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items/{line_num}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://connect.instacart.com/v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items/{line_num}"
payload := strings.NewReader("{\n \"delivered_count\": 1,\n \"delivered_weight\": 1,\n \"status\": \"string\",\n \"replacement_item\": {\n \"upc\": \"string\"\n },\n \"scans\": [\n {\n \"scanned_string\": \"string\",\n \"scanned_string_type\": \"string\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Treat-Ids-As-Internal", "true")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
Field | Type | Required | Description |
---|---|---|---|
success | boolean | Whether the request was successful. |
Response examples
200 Success
200
Item is found200
Item is replaced via UPC200
Item is to be refunded
{
"success": true
}
{
"success": true
}
{
"success": true
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Status not specified | "can't be blank" | 1001 | {"key":"status"} |
400 | Incompatible order status | "Incompatible order status" | 3003 | Not applicable |
400 | Replacement item not found | "Replacement item not found." | 1001 | {"key":"replacement_item"} |
404 | Order not found | "Resource not found" | 4000 | Not applicable |
404 | Order item not found | "Order item not found." | 4000 | Not applicable |