Create an order item as a shopper
POST /v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items
Creates an order item as a shopper.
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. | |
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. | |
item | Item | The item to add. | |
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. |
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 POST \
--url 'https://connect.instacart.com/v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items' \
--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,
"item": {
"upc": "string"
},
"scans": [
{
"scanned_string": "string",
"scanned_string_type": "string"
}
]
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items")
.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 \"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 \"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("POST", "/v2/fulfillment_sandbox/shoppers/{shopper_id}/orders/{order_id}/items", 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"
payload := strings.NewReader("{\n \"delivered_count\": 1,\n \"delivered_weight\": 1,\n \"item\": {\n \"upc\": \"string\"\n },\n \"scans\": [\n {\n \"scanned_string\": \"string\",\n \"scanned_string_type\": \"string\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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 created via RRC200
Item is created via UPC
{
"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 | Item not specified | "can't be blank" | 1001 | {"key":"item"} |
400 | Incompatible order status | "Incompatible order status" | 3003 | Not applicable |
400 | Item not found | "Item not found." | 1001 | {"key":"item"} |
404 | Order not found | "Resource not found" | 4000 | Not applicable |