Handle order item replacement
PUT /v2/post_checkout/orders/{order_id}/items/{order_item_id}/replacement
Approve a replacement made to an item while the order is being shopped or request a refund. Replacements must be resolved before the shopper has checked out.
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
order_id | path | string | The order ID. | |
order_item_id | path | string | The order item ID. |
Request
Field | Type | Required | Description |
---|---|---|---|
status | string | The requested status of the replacement. One of 'APPROVED' or 'REJECTED'. |
Request examples
- cURL
- Java
- Python
- Go
curl --request PUT \
--url 'https://connect.instacart.com/v2/post_checkout/orders/{order_id}/items/{order_item_id}/replacement' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"status": "APPROVED"
}'
HttpResponse<String> response = Unirest.put("https://connect.instacart.com/v2/post_checkout/orders/{order_id}/items/{order_item_id}/replacement")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"status\": \"APPROVED\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"status\": \"APPROVED\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("PUT", "/v2/post_checkout/orders/{order_id}/items/{order_item_id}/replacement", 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/post_checkout/orders/{order_id}/items/{order_item_id}/replacement"
payload := strings.NewReader("{\n \"status\": \"APPROVED\"\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>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
None.Response examples
200 Success
200
Replacement approved
{
// Empty
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Status not present* | "There were issues with your request" | 9999 | Not applicable |
400 | Status not valid | "is not included in the list" | 1001 | {"key":"status"} |
404 | Order not found | "Resource not found" | 4000 | Not applicable |
404 | Order item not found | "Order item 1111 not found" | 4000 | Not applicable |